fzdream 发表于 2011-7-6 09:20 
请问 如何用_n_表示最后一列的数据?或者用什么去定位最后一列呢?
我想用宏变量去使用每个数据集最后一列的数据
You may consider using point option to access the last observation directly. Here is an example to illustrate the idea.
49 data t1;
50 seed=123;
51 n=ceil(ranuni(seed)*100);
52 do i=1 to n;
53 y=rannor(seed);
54 output;
55 end;
56 run;
NOTE: The data set WORK.T1 has 76 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
57
58 data _null_;
59 set t1 point=nobs nobs=nobs;
60 call symputx('yvalue', y);
61 stop;
62 run;
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
63
64 %put >>>>y=&yvalue<<<<;
>>>>y=-0.56309658011143<<<<