Programming the statistical procedures from SAS

Random Number Generator

Reply
New Contributor
Posts: 3

Random Number Generator

Hello,

The change in random number generators between 9.2 and 9.3 is giving me some problems.  Specifically, I need to replicate the random number generation process in 9.2 (using ranuni), while using the 9.3 software.  I found a link a while back that claimed to have code to do this, but it became inactive before I could test it.  Does anyone have experience with this?  Specifically, I need to be able to validate that samples generated using 9.2 were done correctly, while having access to only the 9.3 software.

Thanks!

Grand Advisor
Posts: 16,908

Re: Random Number Generator

What does your SAS 9.2 code look like? Did  you use the streamint function in 9.2 as well?

New Contributor
Posts: 3

Re: Random Number Generator

just your standard ranuni:

proc surveyselect data = frame 

          out = pj.sample  samplesize = 80  seed = 20047

run;

or, ranuni within a datastep.

Emma

New Contributor
Posts: 3

Re: Random Number Generator

and no, never used teh streamint function. 

SAS Super FREQ
Posts: 3,310

Re: Random Number Generator

Back in the 9.2 days PROC SURVEYSELECT used the RANUNI algorithm, as documented here:

SAS/STAT(R) 9.2 User's Guide, Second Edition

In your example, the PROC uses the default sampling method, which is SRS (simple random samples without replacement). The doc says that "PROC SURVEYSELECT uses Floyd’s ordered hash table algorithm for simple random sampling....  See Bentley and

Floyd (1987) and Bentley and Knuth (1986) for details."  So I'd look up the algorithm and use the RANUNI function in the SAS 9.3 DATA step to try to recreate the 9.2 behavior.

Ask a Question
Discussion stats
  • 4 replies
  • 302 views
  • 0 likes
  • 3 in conversation