k******a 发帖数: 816 | 1 下面这段code运行可以实现运行一百次的目的,但是我不知道怎么把100次的结果全都
输出?查了library里面的normalt, 只显示一次的结果。非常感谢!
%MACRO RUNNING(iter);
%do i = 1 %to &iter;
DATA normalt;
*mean 3.2, standard deviation 0.3;
rnormalt=3.2+0.3*NORMAL(0);
output;
run;
%END;
%MEND RUNNING;
%RUNNING (100);
RUN; | s******r 发帖数: 1524 | 2 DATA normalt;
*mean 3.2, standard deviation 0.3;
do i =1 to 100;
rnormalt=3.2+0.3*NORMAL(0);
output;
end;
drop i;
run;
?
【在 k******a 的大作中提到】 : 下面这段code运行可以实现运行一百次的目的,但是我不知道怎么把100次的结果全都 : 输出?查了library里面的normalt, 只显示一次的结果。非常感谢! : %MACRO RUNNING(iter); : %do i = 1 %to &iter; : DATA normalt; : *mean 3.2, standard deviation 0.3; : rnormalt=3.2+0.3*NORMAL(0); : output; : run; : %END;
| r******l 发帖数: 240 | 3 本人半瓶子醋。
Change your "DATA normalt" into "DATA normalt&inter", I think you will get
what you want.
Using your code, every time you run your program, the output data will write
over the data from the last run. That is why you only get one data when
you finish running your program.
【在 k******a 的大作中提到】 : 下面这段code运行可以实现运行一百次的目的,但是我不知道怎么把100次的结果全都 : 输出?查了library里面的normalt, 只显示一次的结果。非常感谢! : %MACRO RUNNING(iter); : %do i = 1 %to &iter; : DATA normalt; : *mean 3.2, standard deviation 0.3; : rnormalt=3.2+0.3*NORMAL(0); : output; : run; : %END;
| l*********s 发帖数: 5409 | 4 the code is wrong; move the %do %to statement into the Macro. |
|