sas - Split a dataset into two new dataset based on percentage of split -
i want split large dataset randomly 2 new dataset in ratio of 70% - 30%.
basically need allocate 70% of random values large dataset newdataset1 , 30% of random values largedataset newdataset2.
can please sas code me achieve it.
a dummy code help..
proc sql or sas statement. work me.
for complex sample design (like stratified randomization, e. g.) proc surveyselect
way go, @keith said. simple random splitting rantbl
-function trick:
data newdataset1 newdataset2; set have; flag=rantbl(-1, 0.7, 0.3); if flag=1 output newdataset1; else output newdataset2; run;
Comments
Post a Comment