BookmarkSubscribeRSS Feed
doylejm
Fluorite | Level 6

Should I be able to reproduce a random sample of draws from the standard normal (rannor) generated by someone else as long as I use the same seed number? Would the sample differ depending on version of SAS, machine or any other factors? Thank you. jm

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Use

 

call streaminit(123);

if you are simulating data in a datastep. Use

 

call randseed(123);

if you are simulating data in IML. the two algorithms are the same for the datastep and IML and to my knowledge you will get the same results across most sas versions as well 🙂

ballardw
Super User

You may have an issue of duplicating if the other use actually uses Rand('normal') or possibly Call Rannor instead of Rannor.

Rick_SAS
SAS Super FREQ

Draycut gave the correct answer for the RAND (or RANDGEN) function. (For a longer answer, see "Random number streams in SAS.") However, you asked about the RANNOR function, which takes the seed as an argument.

 

The answer is still "yes." Up to numerical precision, you should get the same values for RANNOR as long as you use the same seed.  Some people use the seeds incorrectly, so be sure to read "Random number seeds: Only the first seed matters"  to make sure you understand how seeds initialize streams.

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!

How to Concatenate Values

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.

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
  • 3 replies
  • 892 views
  • 1 like
  • 4 in conversation