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

 CALL STREAMINIT(seed);

### Arguments

seed

is an integer seed value.

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

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.

### 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;```

```                                 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```

 Functions:

 Previous Page | Next Page | Top of Page