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

Hello, 

I am a new user of PROC SURVEYSELECT in Base SAS 9.4 and I need to set the sample size to be 10% of the total population size.  I don't need to stratify the population.  How would I set the samp size option to execute PROC SURVEYSELECT on only that 10%?  Would it be as simple as the sampsize option below?  Thank you in advance for your help - I really appreciate it!

 

 

proc surveyselect data=other_list out=elos1 
sampsize=0.1
seed=&seed.; run;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

SAMPSIZE generates an error that it needs an integer, so SAMPRATE will be what you need. And 0.1 is 10%. 

 

 

 

View solution in original post

8 REPLIES 8
Reeza
Super User
What happens when you run it? That should tell you if it's right or not. Or are you getting unexpected behaviour?
esvenson
Fluorite | Level 6

Hi Reeza,

I don't know if I should be using sampsize=0.1 or samprate=0.1.  Can you advise which one will yield a 10% sample of the population?

 

Thanks,

Eric

Reeza
Super User

SAMPSIZE generates an error that it needs an integer, so SAMPRATE will be what you need. And 0.1 is 10%. 

 

 

 

SAS_Rob
SAS Employee
Hi Eric:



You should be using the SAMPRATE= option if you are going to supply it with a sampling rate.


esvenson
Fluorite | Level 6

Is there also a way to have multiple constraints in a PROC SURVEY SELECT like this?  I have a list of factors that all have to be >0 for to meet the criteria for inclusion in the sample population.  I can't find an example of this anywhere.  Thank you again for all your help!

 

proc surveyselect data=other_list (where = (factor4>0) and (factor5>0)) out=test  samprate=0.1  seed=&seed.;
run;
Reeza
Super User
The WHERE statement is what I would suggest or pre-filtering the data would also work.
esvenson
Fluorite | Level 6

Reeza, 

I tried this but it was an invalid use of the AND operator.  Is there a way to do a list of multiple constraints in a PROC SURVEYSELECT step so that ALL factors that must be >0 are included?  Thanks!

 

proc surveyselect data=other_list (where = (factor4>0) and (factor5>0)) out=test  samprate=0.1  seed=&seed.;
run;
Reeza
Super User
(where = (factor4>0 and factor5>0))

 

You had brackets too early, closing the WHERE condition, I think. Try the above.

 

Unfortunately you're stuck listing the factors but you can check if the max is 0 and that should be enough?

Untested.

 

(where = (not max(factor1, factor2, factor3, ... factor9) = 0));

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1960 views
  • 0 likes
  • 3 in conversation