In SAS/IML there are essentially two ways. The random sample can be generated one at a time with the usual Base SAS functions. call streaminit(1234); do i = 1 to 10; b = rand('binomial', 0.05, 20); /* p=0.05 n=20 */ p = rand('poisson', 5); /* lambda=5 */ print b p; end; However the RANDGEN call is usually the best option. In general it is more efficient not to use a loop and generate the random numbers all at the same time. b = j(10, 1); p = j(10, 1); call randseed(4321); call randgen(b, 'binomial', 0.05, 20); call randgen(p, 'poisson', 5); print b p;
... View more