Data visualization with SAS programming

Trying to generate random numbers

Reply
Super Contributor
Posts: 255

Trying to generate random numbers

when I run the below code again and again the dataset is the same but I want the numbers to be randomly generated

data obs;

   do i= 1 to 8;

      x= round(100* ranuni(123),1);

      y= round(100* ranuni(789),1);

      output;

   end;

run;

Respected Advisor
Posts: 3,768

Re: Trying to generate random numbers

Change the SEED.

SAS Super FREQ
Posts: 1,043

Re: Trying to generate random numbers

Using a SEED <= 0 will generate different results (using time of day as the seed).

Grand Advisor
Posts: 16,307

Re: Trying to generate random numbers

Change the seed to the RanUNI function or use a different random number generation method.

http://blogs.sas.com/content/iml/2011/08/24/how-to-generate-random-numbers-in-sas.html

Post a Question
Discussion Stats
  • 3 replies
  • 303 views
  • 0 likes
  • 4 in conversation