proc iml; options nodate pagesize=60 linesize=80; *This program generates a sampling distribution of standard deviatons from data drawn from a normal distribution. You need to input parameters for mu, the population mean, SD, the population standard deviation, N (sample size) and number of samples Nsam; *input mu, population mean; mu = 10; *Input SD, the population standard deviation; SD=5; *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=2; 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; dev=sample-j(N,1,mean); devsq=dev#dev; var=devsq[+,]/(N-1); sdev=sqrt(var); out1[h,]=sdev; 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;