data Sample;
n=1; /* n=500 is sample sizes each*/
DSize=122533; /* DSize is number of records in the original data set involved in random sample: You can select your own */
do while (n < 501);
Slice=int(DSize*ranuni(-1));
set mydataset point=Slice; /* you have to replace mydataset with one of your existing dataset here*/
if ( (compress(Language) in ('2')) and (compress(Form) in ('42')) and (n<=500)) then do;
/* This is a some of my arguments imposed on selection: you can have your own.*/
output sample;
n=n+1;
end;
end;
stop;
drop n;
run;
data Sample1 sample2;
n1=0; n2=0; /* n1, n2 are smaple sizes Suppose we want to have 2 male and female samples of 100 each*/
do while ((n1+n2)< 200);
Slice=int(69514*ranuni(-1)); /* This is # of observations in your data set */
set mydataset point=Slice; /* u have to replace mydataset with one of your existing dataset here*/
if gender=1 and n1<=100) then do;
output sample1;
n1=n1+1;
end;
else if (n2<=100) then do;
output sample2;
n2=n2+1;
end;
end;
stop;
drop n1 n2;
run;