Hello Maithili,
There is a more "elegant" way to handle this kind of problem, I think. The trick is to "unsort" the original dataset. Of course, I would'nt recommend to do that if your orginal dataset is very large because sorting is involved. What is nice is that you simply add a flag to your original population indicating where the "record goes".
Here is an example. You'll have exactly 100 observations in the control group, 400 in the rest of sample and the rest would'nt be selected.
Here is the example:
data T01_population;
do i=1 to 10000;
output;
end;
run;
proc sql;
create table T02_population_unsorted as
select *
from T01_population
order by ranuni(0);
quit;
data T03_groups;
set T02_population_unsorted;
select;
when(_N_ le 100) group='CG';
when(_N_ le 500) group='RS';
otherwise group='--';
end;
run;
Other possibility: you use a probability to decide "where the record goes". Even faster. You don't need to sort the dataset.
data T03_groups;
set T01_population;
select;
when(ranuni(0) le 0.1 ) group='CG';
when(0.1 lt ranuni(0) le 0.2) group='RS';
otherwise group='--';
end;
run;
There are many other possibilities that would apply if the population is verrrryyyyy large, for example or if you want to extend it to stratified sampling or ... Let me know if you need further help.
Best regards,
Yoba