1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| %macro tasr(libref=,nbgroup=,nb=,preftabin=groupe,preftabout=PREMANDAT_);
options mprint;
%do i=1 %to &nbgroup.;
%let nb&i=0;
DATA _null_;
SET &libref..&preftabin&i. END=eof;
IF eof THEN DO;
CALL SYMPUT("nb&i.",min(&nb.,put(_N_,8.)));
END;
run;
data &libref..&preftabout&i. (drop=i j count);
count=0;
array obsnum(&nb) _temporary_;
do i=1 to &&nb&i.;
redo:
select=ceil(ranuni(12345)*n);
set &libref..&preftabin&i. point=select nobs=n;
do j=1 to count;
if obsnum(j)=select then
goto redo;
end;
position=select;
count=count+1;
obsnum(count)=select;
output;
end;
stop;
set &libref..&preftabin&i.;
run;
%end;
%mend;
/*PELICAN_&dat_mdt */
%tasr(libref=work,nbgroup=4,nb=10); |
Partager