CALL STREAMINIT Routine

Specifies a seed value to use for subsequent random number generation by the RAND function.

Category: Random Number

Syntax

CALL STREAMINIT(seed);

Required Argument

seed

is an integer seed value.

Range seed < 231 – 1
Tip If you specify a nonpositive seed, then CALL STREAMINIT is ignored. Any subsequent random number generation seeds itself from the system clock.

Details

If you want to create reproducible streams of random numbers, then specify CALL STREAMINIT before any calls to the RAND random number function. If you call the RAND function before you specify a seed with the CALL STREAMINIT routine (or if you specify a nonpositive seed value in the CALL STREAMINIT routine), then the RAND function uses a call to the system clock to seed itself. Each DATA step honors one CALL STREAMINIT seed. The prevailing seed value is the one that is specified prior to the first RAND function call. For more information about seed values see Seed Values.

Example: Creating a Reproducible Stream of Random Numbers

The following example shows how to specify a seed value with CALL STREAMINIT to create a reproducible stream of random numbers with the RAND function.
data random;
   call streaminit(123);
   do i=1 to 10;
      x1=rand('cauchy');
      output; 
   end; 
proc print data=random; 
   id i; 
run;
Number String Seeded with CALL STREAMINIT
Number String Seeded with CALL STREAMINIT

See Also

Functions: