To create a dataset with unique values of
a given varible using a data step and the
FIRST. and LAST. varaibales, it is assumed
that the input dataset is:
A.
sorted on that variable.
B.
indexed by that variable.
C.
naturally in order.
D.
any of the above A, B, or C
参考答案是A . 可是我使用以下测试程序,感觉B也是可以的.求高人帮忙解释
data test;
input x y $ @;
datalines;
5 china
3 japan
7 america
5 france
2 korea
2 british
;
run;
data out;
set test;
if first.x ;
run;
上述第二段程序在未sort或建立index时会报错,因此C, D都错.
关键是,用以下代码建立index后,上面的第二段程序执行成功,结果也正确.
prog sql;
create index x on work.test;
quit;
请各位高手指点迷津.谢谢!



雷达卡




京公网安备 11010802022788号







