mingfeng07 发表于 2014-12-30 09:11 
恩,有道理,在循环最后加一个:
有时我们更希望能加上ID值,如图,看看最大最小五个值所对应的ID号。
有如下方法:
data test;
input id$ x y z ;
cards;
201 2 3 1
202 4 8 6
309 4 3 6
205 4 6 8
307 9 3 1
401 11 24 65
504 47 95 21
361 78 4 2
804 6 47 8
631 14 13 47
99 14 18 64
85 111 23 47
;
run;
ods output ExtremeObs=race_e;
proc univariate data=test nextrobs=5;
var x y z;
id id;
run;
ods output close;
这种方法同样是变量多不方便,不知仁兄能否改进你的宏添加ID号进去