http://bbs.pinggu.org/forum.php?mod=viewthread&tid=886738&page=1#pid9952820
http://bbs.pinggu.org/thread-1201855-1-1.html
/* macro */
%macro split(num);
data _null_;
if 0 then set sashelp.class nobs=count;
call symput('numobs',put(count,8.));
run;
%let m = %sysevalf(&numobs/&num, ceil);
%do I=1 %to &m;
data orig_&I;
set sashelp.class;
if %eval(&num*(&I-1)) <_n_<= %eval(&num*&I);
run;
%end;
%mend split;
%split(8);
/* hash */
data _null_ ;
dcl hash hh ( ) ;
hh.definekey ('k' ) ;
hh.definedata ('sex', 'name', 'age', 'height', 'weight') ;
hh.definedone () ;
do until(mod(k,8)=0 or last);
k+1;
set sashelp.class end=last ;
hh.add();
end;
gp+1;
hh.output(dataset: 'a'||strip(gp));
run;
/* call excute */
data _null_;if 0 then set sashelp.class nobs=nobs;
length dslist $100;
size=8;
dsnum=ceil(nobs/size);
do i=1 to dsnum;
dslist=cat(strip(dslist)," ds"||strip(i));
end;
call execute("data "||trim(dslist)||";");
call execute(" set sashelp.class;");
do i=1 to dsnum;
call execute( " if "||strip((i-1)*size)||" <_n_<= "||strip(i*size)||" then output ds"||strip(i)||";");
end;
call execute("run;");
run;