for large dataset and exact number of samples the following is an example
from the SAS advanced certificate guide of the fastest algorithm to serve
that purpose
much faster than proc surveyselct
data work.rsubset(drop=obsleft sampsize);
sampsize=100;
obsleft=totobs;
do while(sampsize>0);
pickit+1;
if ranuni(0)
set sasuser.revenue point=pickit
nobs=totobs;
output;
sampsize=sampsize-1;
end;
obsleft=obsleft-1;
end;
stop;
run;
Sasuser.Revenue is the original data set.
sampsize is the number of observations to read into the sample.
Work.Rsubset is the data set that contains the random sample that you are
creating.
obsleft is the number of observations in the original data set that have not
yet
been considered for selection.
totobs is the total number of observations in the original data set.
pickit is the number of the observation to be read into the sample data set
(if the
RANUNI expression is true), and its starting value is 0.