嗯 这样是快很多的
做了个测试
data ex;
do id=1 to 1000000;
output;
end;
run;
data temp;
do i=1 to 100;
temp=cats('test',i);
output;
end;
run;
proc sql noprint;
select temp into:data separated by ' ' from temp;
quit;
%macro test;
data &data;
set ex;
%do i=1 %to 100;
if 10000*%eval(&i-1)<id<=10000*&i
then output test&i;
%end;
run;
%mend;
%test
%macro test1;
%do i=1 %to 100;
data test&i;
set ex;
where 10000*%eval(&i-1)<id<10000*&i;
%end;
run;
%mend;
%test1
明显感觉上面那种方法更快