Creating the Example Data
The full data set proc contents data=fram.fram40;run;
Select a sample of specified size keeping only the variables desired. /*select a random sample of size 15*/ proc surveyselect data=fram.fram40(keep=spf1-spf5) out=ftmp method=srs sampsize=15 seed=54321 ; run;
Assign an id to each observation /*assign a meaningless id*/ data ftmp; length id 8; set ftmp; id=_n_; run;
Examine the data set proc print data=ftmp;run;
Changing the descriptor portion PROC DATASETS /*get rid of labels and formats*/ proc datasets lib=work memtype=data; modify ftmp; attrib _all_ label=' '; attrib _all_ format=; quit;
Sort the data in random order /*do a random sort on data*/ data ftmp; set ftmp; call streaminit(5764313); ranx=rand("uniform"); id=_n_; run; proc sort data=ftmp;by ranx;run;
Create 5 separate files /*create a separate file for each of the exams*/ data sbp1(keep=id spf1 rename=(spf1=sbp)) sbp2 (keep=id spf2 rename=(spf2=sbp)) sbp3 (keep=id spf3 rename=(spf3=sbp)) sbp4 (keep=id spf4 rename=(spf4=sbp)) sbp5 (keep=id spf5 rename=(spf5=sbp)) ; set ftmp; output sbp1; output sbp2; output sbp3; output sbp4; output sbp5; run;
Examine Results proc contents data=sbp1;run;