SAS Base (38)

Given the SAS data set WORK.ONE:

X Y Z
1 A 27
1 A 33
1 B 45
2 A 52
2 B 69
3 B 70
4 A 82
4 C 91

The following SAS program is submitted:

data WORK.TWO;
set WORK.ONE;
by X Y;
if First.Y;
run;
proc print data=WORK.TWO noobs;
run;

Which report is produced?

A.

X Y Z
1 B 45
2 A 52
2 B 69
3 B 70
4 A 82
4 C 91

B.

X Y Z
1 A 27
1 B 45
2 A 52
2 B 69
3 B 70
4 A 82
4 C 91

C.

X Y Z
1 A 33
1 B 45
2 A 52
2 B 69
3 B 70
4 A 82
4 C 91

D. The PRINT procedure fails because the data set WORK.TWO is not created in the DATA step.

Check Answer
Answer: B

注解:将数据按X和Y分组,并将各个分组中的第一个观测值输入到WORK.TWO中。FIRST.variable的具体解释查看SAS Base (1)

Leave a Reply

Your email address will not be published. Required fields are marked *