CALL STREAMINIT Routine


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 );

Arguments

seed

  • is an integer seed value.

  • Range: seed < 2 31 __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. For more information about seed values see 'Seed Values' on page 257.

Examples

Example 1: 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.

 options nodate ps=60 ls=80 pageno=1;  data random;     call streaminit(123);     do i=1 to 10;        x1=rand('cauchy');        output;     end;  proc print data=random;     id i;  run; 
Output 4.17: Random Number String Seeded with CALL STREAMINIT
start example
 The SAS System                                     1    i        x1    1   0.17593    2      3.76106    3      1.23427    4      0.49095    5   0.05094    6      0.72496    7   0.51646    8      7.61304    9      0.89784   10      1.69348 
end example
 

See Also

Function:

  • 'RAND Function' on page 766




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net