Chapter Contents 
Previous 
Next 
CALL RANTBL 
Category:  Random Number 
Syntax  
Arguments  
Details  
Comparisons  
Examples  
See Also 
Syntax 
CALL RANTBL(seed,p_{1}, . . . p_{i}, . . . , p_{n},x); 
Range:  seed < 2^{31}  1 
Note:  If seed 0, the time of day is used to initialize the seed stream. 
Range:  0 p_{i} 1 for 0< i n 
Details 
The CALL RANTBL routine updates seed and returns a variate x generated from the probability mass function defined by p_{1} through p_{n}.
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 inverse transform method applied to a RANUNI uniform variate is used. The CALL RANTBL routine returns these data:
If, for some index j<n,
RANTBL returns only the indices 1 through j, with the probability of occurrence of the index j equal to
Comparisons 
The CALL RANTBL routine gives greater control of the seed and random number streams than does the RANTBL function.
Examples 
This example uses the CALL RANTBL routine:
options nodate pageno=1 linesize=80 pagesize=60; data case; retain Seed_1 Seed_2 Seed_3 45; input p1p9; do i=1 to 10; call rantbl(Seed_1,of p1p9,X1); call rantbl(Seed_2,of p1p9,X2); X3=rantbl(Seed_3,of p1p9); if i=5 then do; Seed_2=18; Seed_3=18; end; output; end; datalines; .02 .04 .06 .08 .1 .12 .14 .16 .18 ; proc print; id i; var Seed_1Seed_3 X1X3; run;
The RANTBL Example shows the results.
The SAS System 1 i Seed_1 Seed_2 Seed_3 X1 X2 X3 1 694315054 694315054 45 6 6 6 2 1404437564 1404437564 45 8 8 8 3 2130505156 2130505156 45 10 10 10 4 1445125588 1445125588 45 8 8 8 5 1013861398 18 18 7 7 7 6 1326029789 707222751 18 8 6 8 7 932142747 991271755 18 7 7 7 8 1988843719 422705333 18 10 4 10 9 516966271 1437043694 18 5 8 5 10 2137808851 1264538018 18 10 8 10 
Changing Seed_2 for the CALL RANTBL statement, when I=5, forces the stream of variates for X2 to deviate from the stream of variates for X1. Changing Seed_3 on the RANTBL 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.