Functions and CALL Routines 
Returns a random variate from a binomial distribution.
Category: 
Random Number

Tip: 
If you want to change the seed value during execution,
you must use the CALL RANBIN routine instead of the RANBIN function.


seed

is a numeric constant, variable, or expression
with an integer value. If seed 0, the time of day is used
to initialize the seed stream.
Range: 
seed <
2^{31}1 
See: 
Seed Values for more information about seed
values 

n

is a numeric constant, variable, or expression
with an integer value that specifies the number of independent Bernoulli trials
parameter.

p

is a numeric constant, variable, or expression
that specifies the probability of success.
The RANBIN function returns a variate
that is generated from a binomial distribution with mean np and
variance np(1p). If n 50, np 5, or n(1p) 5, an inverse transform
method applied to a RANUNI uniform variate is used. If n > 50, np > 5, and n(1p) > 5, the normal approximation
to the binomial distribution is used. In that case, the BoxMuller transformation
of RANUNI uniform variates is used.
For a discussion about seeds and streams of data, as well as examples
of using the randomnumber functions, see Generating Multiple Variables from One Seed in RandomNumber Functions.
The CALL RANBIN routine, an alternative
to the RANBIN function, gives greater control of the seed and random number
streams.

Functions and CALL routines:

Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.