BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I have a question about changing random seed for every round in the loop.

Say I have a loop:

do i=1 to 1000;

...then in one of the following steps I need to use proc surveyselect which requires me to specify a random seed (e.g., seed=123).

because I need to get different random samples, I want different seed for different i (e.g., seed=123 for i=1, seed=124 for i=2, seed=125 for i=3...).

It seems to me a positive integer should follow the seed= statement. Is there anyway to achieve the above mentioned procedure?

Thank you very much for your help!

sliu
4 REPLIES 4
DanielSantos
Barite | Level 11
Hello sli.

Anything wrong about not specifying the SEED option and let SAS use the default which is the time of day of the system's clock?

Cheers from Portugal.

Daniel Santos @ www.cgd.pt;

run;
deleted_user
Not applicable
Thank you, Daniel!
That's fine for my current purpose. But I would like it to be able to replicate in the future.
DanielSantos
Barite | Level 11
OK.

Then you should take a look on macro variables.

Check the online documentation:
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002293823.htm

Easily accomplished with a macro variable.

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.
deleted_user
Not applicable
I will! Thanks!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1511 views
  • 0 likes
  • 2 in conversation