* Arrays, macros, and output data for repeated computations; * An application to simulation; %let nsamps = 10000; %let sampsize = 500; %let dist = exp; * Possible values are 'uni' 'nor' 'exp' 'cau.' Other distributions require parameters to be added below.; %let mu = 1; * Possible values are 0.5, 0, or 1, depending on the distribution specified above.; data sim; array sample{&nsamps}; do i = 1 to &sampsize; /* this counter will cycle over observations */ do j = 1 to dim(sample); /* this counter will cycle over variables */ sample{j} = ran&dist(20110228); end; output; end; drop i j; run; proc summary data=sim; var _all_; output out=unimeans; run; data par; set unimeans; where _stat_ eq "MEAN"; array sample{&nsamps}; do j = 1 to dim(sample); /* loop over variables */ parameter = sample{j}; output; end; drop j sample:; run; proc sgplot data=par; histogram parameter; density parameter /type=normal(mu=&mu); run;