Hi,
I'm looking to extract 41,000 accounts out of my 200,000 account dataset using random sampling. I want the random sampling to be done based on the proportions of my 'band' variable, which has the following distribution:
0-<2441 makes up 15.63%
2449-20001 makes up 80.04%
200001-High makes up 4.33%
Please can someone tell me what code I could use to randomly get the 41,000 accounts I want based on the proportions (it's fine if the proportions are slightly different, as long as it equals 41,000 accounts)? In my example, the random sampling would mean about 6,150 in the 0-<2441 band, about 32,800 accounts in the 2449-20001 band, and about 1,640 accounts in the 200001-High band. I've seen proc surveyselect can be used (and I think proc sort of my accounts by 'band' might need to be done beforehand), but I'm not sure how to write the code to get what I require.
You need proportional allocation as done here:
proc surveyselect data=Customers n=41000
out=SampleCust;
strata BAND / alloc=prop ;
run;
Koen
You need proportional allocation as done here:
proc surveyselect data=Customers n=41000
out=SampleCust;
strata BAND / alloc=prop ;
run;
Koen
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.