Functions and CALL Routines |
Returns a random variate from an exponential distribution.
-
seed
-
is the seed value. A new value for seed is returned each time CALL RANEXP is executed.
-
x
-
is a numeric variable. A new value for
the random variate x is returned each time CALL
RANEXP is executed.
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.
For a discussion and example of an effective use of the random number
CALL routines, see Starting, Stopping, and Restarting a Stream.
The CALL RANEXP routine gives greater
control of the seed and random number streams than does the RANEXP function.
This
example uses the CALL RANEXP routine:
options pageno=1 ls=80 ps=64 nodate;
data u1(keep=x);
seed = 104;
do i = 1 to 5;
call ranexp(seed, x);
output;
end;
call symputx('seed', seed);
run;
data u2(keep=x);
seed = &seed;
do i = 1 to 5;
call ranexp(seed, x);
output;
end;
run;
data all;
set u1 u2;
z = ranexp(104);
run;
proc print label;
label x = 'Separate Streams' z = 'Single Stream';
run;
Output from the CALL RANEXP Routine
The SAS System 1
Separate Single
Obs Streams Stream
1 1.44347 1.44347
2 0.11740 0.11740
3 0.54175 0.54175
4 0.02280 0.02280
5 0.16645 0.16645
6 0.21711 0.21711
7 0.75538 0.75538
8 1.21760 1.21760
9 1.72273 1.72273
10 0.08021 0.08021
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.