Which step sorts the observations of a permanent SAS data set by two variables and stores the sorted observations in a temporary SAS data set?
A.
proc sort out=EMPLOYEES data=EMPSORT;
by Lname and Fname;
run;
B.
proc sort data=SASUSER.EMPLOYEES out=EMPSORT;
by Lname Fname;
run;
C.
proc sort out=SASUSER.EMPLOYEES data=WORK.EMPSORT;
by Lname Fname;
run;
D.
proc sort data=SASUSER.EMPLOYEES out=SASUSER.EMPSORT;
by Lname and Fname;
run;
Answer: B
注解:DATA指定需要被排序的data set,OUT指定存放排序后数据的data set,如果省略OUT,SAS则会用排序后的数据替换原始数据。BY statement后直接列出需要排序的变量名,并以空格隔开。WORK library中的dataset都为临时data set,即关闭SAS后这些数据都将被移除,以WORK.dataset表示,其中WORK可以省略,例如:WORK.EMPSORT或EMPSORT。其他library中的都为永久data set,以libref.dataset表示,例如:SASUSER.EMPLOYEES。