Hi
I trying to create a sampling frame. It is a unique problem in that I want to divide a population into two samples that have been stratified by several variables (Demographics/Gender/ etc). I however don't just want a sample of the population, I want to divide the data into two sample, A and B.
I have run a proc freq to get the marginal probabilities and have joined them to my original data.
Is there a way to specify to proc surveyselect how to say I want a sample with 50% of my data? The samplesize arguments specify the samples per strata which is not what I want exactly.
Any help would be appreciated.
Ended up using the SRS method and just verifying the marginal probabilities afterwards. This worked fine.
PROC SURVEYSELECT data = mydata method = srs n= 2648 seed = 1234 out = srs_method ; RUN;
You might provide a small example of your data and what you would expect a possible result to look like after your process.
You may only need the Groups= option.
Both the SAMPSIZE and SAMPRATE options allow use of a data set to control the numbers/rates per strata combination. So if you set that up correctly using your proc freq information that might be what you are looking for. This would be a different data set than your set to sample from and must have a specific structure. So read the documentation.
Anything where you specify one or more strata your selection rate/size is your responsibility to get the "total" that you want.
Thanks for the advice to read the documentation.
Ended up using the SRS method and just verifying the marginal probabilities afterwards. This worked fine.
PROC SURVEYSELECT data = mydata method = srs n= 2648 seed = 1234 out = srs_method ; RUN;
Mark your message as a solution. It doesn't matter that you specified the solution to your own topic.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.