proc iml; options nodate pagesize=60 linesize=80; *This program generates a sampling distribution of means from a normal distribution. You need to input parameters mu (population mean) SD (population SD) N (sample size) and number of samples Nsam; *input mu, the population mean; mu = 50; *input SD, the population standard deviation; SD= 10; *Input the sample size per sample for the sampling distribution; N=50; *Input the number of samples to be included in the sampling distribution; Nsam=1000; out1 = j(Nsam,1,-999); do h=1 to Nsam; * Set for Nsam iterations; sample = normal(j(N,1,0)); *print sample; sample = sample*SD+j(N,1,mu); *print sample; mean=sample[+,]/N; out1[h,]=mean; end; *create output datasets; create out2 from out1; append from out1; quit; data d2; set out2; *If you want to save the distribution, write to an external file; *file 'c:/sas/mike/corrs'; *put col1 8.4; proc univariate plot normal; run;