BookmarkSubscribeRSS Feed
rwlogan
Calcite | Level 5
Hi, (using sas on Linux 6 and 7 ) I am trying to learn about the use of random number generation in the use of proc ds2 and am having a small problem. I have access to sas versions 9.4 m3 and m5 and a program that I have is producing different results. What I am trying to do is to get the same data when generating it outside of proc ds2 and inside ds2 when using multiple threads and the rand function. When using 9.4m3 the first thread's results agree with the first part of the data generated in a data step. When using 9.4m5 this does not happen. Should I be able to get the same results when using the "latest" version of 9.4 in this case? Also, it seems that the values of _threadid_ are different between the two versions. One starts at 0 and the other starts at 1. Thanks for any suggestions on what is happening here. Roger
1 REPLY 1
s_lassen
Meteorite | Level 14

If I understand the documentation for the STREAM and STREAMINIT routines correctly, the first (default) stream initialized has number 0. Which is, I think, the stream you initialize, right after which you switch to another stream, with a random seed. At least that's how I read the documentation. Unfortunately my SAS version is not quite up do date, so I cannot test it.

 

If I am right, you should get different results every time you run your datastep, and not just different results between DS2 and datastep. But perhaps the first stream was numbered 1 in 9.4m3, enabling you to get the same results in two runs. Or perhaps the STREAM routine was just a dummy in that version.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 690 views
  • 0 likes
  • 2 in conversation