Here is an example to use sortn in a random sample.
1)randomly select the obs number and store in an array
2)use direct access to read in data from bigdata.
This appoach may beat sas surveyselect procedure if the bigdata is BIG and sampling size is SMALL.
%let nobs=1000;
data bigdata;
do i = 1 to &nobs;
x=ranuni(123);
output;
end;
run;
%let size=40;
%let seed=78936;
data sample;
array p[&nobs] _temporary_ ;
array pk
pk1-pk&size;
seed = &seed;
do until(done=1);
index=ceil(&nobs*ranuni(seed));
if p[index] = . then do;
p[index]=index;
index2+1;
pk[index2]=index;
if index2=&size then done=1;
end;
end;
call sortn(of pk);
do _i_ = 1 to &size;
obs = pk[_i_];
set bigdata point=obs;
output;
end;
stop;
drop pk: seed done index index2 _i_;
run;
proc print; run;