Solved
Contributor
Posts: 59

# Sampling with strata Problem

Hi all,

I have a SAS code as follow:

proc sort data=filein;

by var1;

proc surveyselect  data=filein method=srs  sampsize=25

seed=12345  out=fileout ;

strata var1;

run;

This code works fine as long as the strata var1 has enough sample size (25) for each group.

If one group of var1 has size less than 25 then sas generates error and stop.

My purpose is that if one group has size less than 25 then all observations are include in the sampling

for that particular group.

How can we code this kind of logic?

Thanks for your kindly assistance.

William

Accepted Solutions
Solution
‎01-15-2015 11:21 AM
Posts: 3,167

## Re: Sampling with strata Problem

Posted in reply to wtien196838

Add one option clause:

proc sort data=filein;

by var1;

proc surveyselect data=filein method=srs sampsize=25

seed=12345 out=fileout  SELECTALL;

strata var1;

run;

All Replies
Solution
‎01-15-2015 11:21 AM
Posts: 3,167

## Re: Sampling with strata Problem

Posted in reply to wtien196838

Add one option clause:

proc sort data=filein;

by var1;

proc surveyselect data=filein method=srs sampsize=25

seed=12345 out=fileout  SELECTALL;

strata var1;

run;

Contributor
Posts: 59

## Re: Sampling with strata Problem

Posted in reply to wtien196838

Wonderful. That simple option solves my problem easily.

Thank you for your help.

William

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
• 2 replies
• 268 views
• 0 likes
• 2 in conversation