Following is an example of the data-set I have
data have;
input institution$ GPA;
cards;
A 3.2
AB 3.4
BC 4.0
DF 3.2
A 4.0
A 3.0
A 3.5
A 3.7
A 3.8
F 3.8
D 3.2
D 3.1
D 3.7
;
run;
Essentially I want to create a macro that selects a random sample from this data set (the actual dataset is much larger). I also want to simulate this sampling procedure, so that for e.g I can do 50 sampling iterations and for each iteration, I get a output data set. I tried creating the following macro to do this
%macro beta (maxj=,datain= ,numofsamples= , dataout=,);
%do j=1 %to &maxj;
proc surveyselect data=&datain
method=srs n=&numofsamples out=&dataout_&maxj;
run;
%end;
%mend;
%beta (maxj=4 ,datain=have ,numofsamples=5,dataout=pool);
Essentially when I run this, want to get outputs data sets so that they are named pool_1,pool_2,pool_3 etc.
However, when I run this macro it doesn't seem to do what I intended. Instead it shows that there is something wrong with the &dataout_&maxj; run;line
Aucun commentaire:
Enregistrer un commentaire