BookmarkSubscribeRSS Feed
Jeff_DOC
Pyrite | Level 9

I need to generate a random sample from a given population. I am using proc surveyselect. The code that generates the sample runs the exact same time each week. If I do not specify a seed option the computer clock is used but since the timing is so close each run the results have far too much verlap week to week. Each observation has several numeric variables and I was thinking of using one of those as a "seed" but I'm not sure if this is the best way.

Would anyone have a bit of expert advice on a good way to move forward?

Thanks very much.

2 REPLIES 2
Ajay
Fluorite | Level 6

Could you make a random number in a datastep, store it as a macro variable, then use that as the seed?

Here's a good read on the random number generator:

http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p026ygl6toz...

Are you using method = srs?  Another option would be to try the other sampling methods...

Jeff_DOC
Pyrite | Level 9

Hi Ajay.

The total population is just over 14,000 and I am using surveyselect to sample .471.

The same observations seem to come up pretty frequently. Almost as if surveyselect assigns a random number and then begins selection at the same place it did on the previous run.

Should I be sorting the data prior to selection?

proc surveyselect data = incoming out = outgoing

     method = srs

     rate = .00471;

          id var1 var2 var3;

run;


sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 773 views
  • 0 likes
  • 2 in conversation