Previous Page | Next Page

Functions and CALL Routines

CALL STREAMINIT Routine



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

Syntax
Arguments
Details
Examples
Example 1: Creating a Reproducible Stream of Random Numbers
See Also

Syntax

CALL STREAMINIT(seed);

Arguments

seed

is an integer seed value.

Range: seed [equation]
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.


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;

Number String Seeded with CALL STREAMINIT

                                 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

See Also

Functions:

RAND Function

Previous Page | Next Page | Top of Page