mardi 20 septembre 2016

How to randomly extract 100 observations from 1000 observations with 10 times

Data alldata;
Do id= 10001 to 11000 ;
x=round(ranuni(12345)*100,0.01);
y=round(ranuni(12345)*100,0.01);
output;
end;
RUN;


%macro samp;
 %let seed=1234;
%do i = 1 %to 10;
PROC sql outobs=100;
create table samp&i. as
  select * from alldata order by   ranuni(&seed);
     /*creating a column of random number*/
   quit;
 %Let seed=%eval(&seed.+2);
%End;
%Mend samp;
%samp

Maybe the program (I copy it from other places) above can solve the problem. BUT I don't understand "order by ranuni(&seed)" clause. Because the variable "ranuni(&seed) " is not correlated with the datasets "allData". Please help me, thank you.




Aucun commentaire:

Enregistrer un commentaire