y****1 发帖数: 400 | 1 I have a large SAS data set (result) with 1599000 observations. It's
actually 1000 replicates of a single file with 1599 observations. Now I
want to output every 1599 observations to a separate data set (result1 -
result1000):
data result1-result1000;
set result;
do i=1 to 1000;
if (i-1)*1599<_N_=
end;
run;
How should I specify the data set that the observations should be written
to? I tried result||'i' but it did not work~
Thank you so much!!!! |
A*******s 发帖数: 3942 | 2 用macro吧,要不也可以用file statement with filevar option,更麻烦点.
%macro abc;
%let fname=result;
%do i=1 %to 1000;
data &fname&i;
set result(firstobs=%eval((&i-1)*1599+1) obs=%eval(&i*1599));
run;
%end;
%mend;
%abc
【在 y****1 的大作中提到】 : I have a large SAS data set (result) with 1599000 observations. It's : actually 1000 replicates of a single file with 1599 observations. Now I : want to output every 1599 observations to a separate data set (result1 - : result1000): : data result1-result1000; : set result; : do i=1 to 1000; : if (i-1)*1599<_N_=: end; : run;
|
g*****d 发帖数: 526 | 3 可以用 call sysmput 把i变成macro variable |
y****1 发帖数: 400 | 4 多谢多谢!用macro做的出来 :)
【在 A*******s 的大作中提到】 : 用macro吧,要不也可以用file statement with filevar option,更麻烦点. : %macro abc; : %let fname=result; : %do i=1 %to 1000; : data &fname&i; : set result(firstobs=%eval((&i-1)*1599+1) obs=%eval(&i*1599)); : run; : %end; : %mend; : %abc
|