- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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??
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Use a dataset as SAMPSIZE= option, as described here
https://documentation.sas.com/doc/en/statug/15.2/statug_surveyselect_details25.htm
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;