Skip to Main Content
Statistical Programming in SAS
book

Statistical Programming in SAS

by John Bailer
April 2015
Intermediate to advanced content levelIntermediate to advanced
460 pages
14h 45m
English
SAS Institute
Content preview from Statistical Programming in SAS
Chapter 11: Programming with Matrices and Vectors 403
J(nsim,2,0), initializes the matrix temp_mat to have nsim rows, and for two
columns to have all zeros.
Display 11.9 Using SAS/IML to estimate π using Monte Carlo integration (pts. in first
quadrant)
proc iml;
nsim = 4000;
temp_mat = J(nsim,2,0);
/* Generate (X,Y) with single call using 'randgen' */
call randseed(21509); * set seed for randgen;
call randgen(temp_mat,'uniform');
temp_mat = temp_mat || (temp_mat[,2]<= sqrt(J(nsim,1,1)-
temp_mat[,1]##2));
pi_over4 = temp_mat[+,3]/nsim;
pi_est = 4*pi_over4;
se_est = 4*sqrt(pi_over4*(1-pi_over4)/nsim);
pi_LCL = pi_est - 2*se ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Elementary Statistics Using SAS

Elementary Statistics Using SAS

Sandra D. Schlotzhauer

Publisher Resources

ISBN: 9781607645047