Hello Community,
I need to get a random sample of 500 records out of 1 million records in which I have SEGMENT_MANAGED is either YES OR NO but I want 20 % SEGMENT_MANAGED = YES(100 records) and 80% SEGMENT_MANAGED = NO(400 records).
The code is given below that I have tried but this gave me 250 records (50%) each SEGMENT_MANAGED =YES or NO.:-
proc surveyselect data = WORK.nps_scrubbed_base_MOB
out= WORK.nps_sample_file_cad_MOB
method= srs
sampsize= 250;
strata SEGMENT_MANAGED;
run;
Could you please someone help me to find out how to do a random sampling with different weighted according to Strata??
Or , assumes your strata is variable is actually character. "No" would come before "Yes" so the first number on the SAMPSIZE list goes with the first strata value, the second with second value and so on. If your Strata variable is actually numeric then make sure you know which value is which so you can get the order correct.
proc surveyselect data = WORK.nps_scrubbed_base_MOB out= WORK.nps_sample_file_cad_MOB method= srs sampsize= (400 100); strata SEGMENT_MANAGED; run;
Use a dataset as SAMPSIZE= option, as described here
https://documentation.sas.com/doc/en/statug/15.2/statug_surveyselect_details25.htm
Or , assumes your strata is variable is actually character. "No" would come before "Yes" so the first number on the SAMPSIZE list goes with the first strata value, the second with second value and so on. If your Strata variable is actually numeric then make sure you know which value is which so you can get the order correct.
proc surveyselect data = WORK.nps_scrubbed_base_MOB out= WORK.nps_sample_file_cad_MOB method= srs sampsize= (400 100); strata SEGMENT_MANAGED; run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.