Help using Base SAS procedures

change random seed

Reply
N/A
Posts: 0

change random seed

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
Super Contributor
Posts: 474

Re: change random seed

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;
N/A
Posts: 0

Re: change random seed

Thank you, Daniel!
That's fine for my current purpose. But I would like it to be able to replicate in the future.
Super Contributor
Posts: 474

Re: change random seed

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.
N/A
Posts: 0

Re: change random seed

I will! Thanks!
Ask a Question
Discussion stats
  • 4 replies
  • 122 views
  • 0 likes
  • 2 in conversation