CALL RANEXP Routine


Returns a random variate from an exponential distribution

Category: Random Number

Syntax

CALL RANEXP ( seed,x );

Arguments

seed

  • is the seed value. A new value for seed is returned each time CALL RANEXP is executed.

  • Range: seed < 2 31 -1

  • Note: If seed 0, the time of day is used to initialize the seed stream.

  • See: 'Seed Values' on page 257 for more information about seed values

x

  • is a numeric variable. A new value for the random variate x is returned each time CALL RANEXP is executed.

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 following output shows the results:

Output 4.8: The RANEXP Example
start example
 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 
end example
 

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:

  • 'RANEXP Function' on page 776




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