Chapter Contents |
Previous |
Next |
CALL RANEXP |
Category: | Random Number |
Syntax | |
Arguments | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
CALL RANEXP(seed,x); |
Range: | seed < 231 - 1 |
Note: | If seed 0, the time of day is used to initialize the seed stream. |
Details |
The CALL RANEXP routine updates seed and returns a variate x that is generated from an exponential distribution that has a parameter of 1.
By adjusting the seeds, you can force streams of variates to agree or disagree for some or all of the observations in the same, or in subsequent, DATA steps.
The CALL RANEXP routine uses an inverse transform method applied to a RANUNI uniform variate.
Comparisons |
The CALL RANEXP routine gives greater control of the seed and random number streams than does the RANEXP function.
Examples |
This example uses the CALL RANEXP routine:
options nodate pageno=1 linesize=80 pagesize=60; data case; retain Seed_1 Seed_2 Seed_3 45; do i=1 to 10; call ranexp(Seed_1,X1); call ranexp(Seed_2,X2); X3=ranexp(Seed_3); if i=5 then do; seed_2=18; seed_3=18; end; output; end; run; proc print; id i; var Seed_1-Seed_3 X1-X3; run;
The RANEXP Example shows the results.
The SAS System 1 i Seed_1 Seed_2 Seed_3 X1 X2 X3 1 694315054 694315054 45 1.12913 1.12913 1.12913 2 1404437564 1404437564 45 0.42466 0.42466 0.42466 3 2130505156 2130505156 45 0.00794 0.00794 0.00794 4 1445125588 1445125588 45 0.39610 0.39610 0.39610 5 1013861398 18 18 0.75053 0.75053 0.75053 6 1326029789 417047966 18 0.48211 0.57102 0.48211 7 932142747 850344656 18 0.83457 0.92566 0.83457 8 1988843719 2067665501 18 0.07674 0.16730 0.07674 9 516966271 607886093 18 1.42407 0.51513 1.42407 10 2137808851 1550198721 18 0.00452 0.91543 0.00452 |
Changing Seed_2 for the CALL RANEXP statement, when I=5, forces the stream of the variates for X2 to deviate from the stream of the variates for X1. Changing Seed_3 on the RANEXP function, however, has no effect.
See Also |
Function:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.