Chapter Contents |
Previous |
Next |
CALL RANCAU |
Category: | Random Number |
Syntax | |
Arguments | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
CALL RANCAU(seed,x); |
Range: | seed < 231 - 1 |
Note: | If seed 0, the time of day is used to initialize the seed stream. |
Details |
The CALL RANCAU routine updates seed and returns a variate x that is generated from a Cauchy distribution that has a location parameter of 0 and scale 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.
An acceptance-rejection procedure applied to RANUNI uniform variates is used. If u and v are independent uniform (-1/2, 1/2) variables and u2+v2 1/4, then u/v is a Cauchy variate.
Comparisons |
The CALL RANCAU routine gives greater control of the seed and random number streams than does the RANCAU function.
Examples |
This example uses the CALL RANCAU 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 rancau(Seed_1,X1); call rancau(Seed_2,X2); X3=rancau(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 RANCAU Example shows the results.
The SAS System 1 i Seed_1 Seed_2 Seed_3 X1 X2 X3 1 1404437564 1404437564 45 -1.14736 -1.14736 -1.14736 2 1326029789 1326029789 45 -0.23735 -0.23735 -0.23735 3 1988843719 1988843719 45 -0.15474 -0.15474 -0.15474 4 1233028129 1233028129 45 4.97935 4.97935 4.97935 5 50049159 18 18 0.20402 0.20402 0.20402 6 802575599 991271755 18 3.43645 4.44427 3.43645 7 1233458739 1437043694 18 6.32808 -1.79200 6.32808 8 52428589 959908645 18 0.18815 -1.67610 0.18815 9 1216356463 1225034217 18 0.80689 3.88391 0.80689 10 1711885541 425626811 18 0.92971 -1.31309 0.92971 |
Changing Seed_2 for the CALL RANCAU 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 RANCAU 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.