BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ishant
Calcite | Level 5

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??

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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;

View solution in original post

2 REPLIES 2
ballardw
Super User

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;

SAS Innovate 2025: Call for Content

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 471 views
  • 1 like
  • 3 in conversation