options ls=72; title "Confidence Intervals - Mineral Content Data"; %let p=3; /* After reading in the data, the statements below stack * the data into "variable", which consists of the labels * for the various bones, and "x", which consists of the * numerical values. */ data mineral; infile "D:\stat505data\mineral.csv" firstobs=2 delimiter=','; input domradius radius domhumerus humerus domulna ulna; variable="domradius"; x=domradius; output; variable="domhumerus"; x=domhumerus; output; variable="dumulna"; x=domulna; output; keep variable x; run; proc sort data=mineral; by variable; run; /* These statements calculate the mean, variance, * and sample size for each bone. The statistics * are then saved to the dataset "a". */ proc means data=mineral noprint; by variable; var x; output out=a n=n mean=xbar var=s2; run; /* These statements work from the statistics * calculated above and construct the 95% * one-at-a-time, bonferroni, and simultaneous * confidence intervals based on the F-multiplier. * The results are then printed to the screen * with the print procedure below. */ data b; set a; t1=tinv(1-0.025,n-1); tb=tinv(1-0.025/&p,n-1); f=finv(0.95,&p,n-&p); loone=xbar-t1*sqrt(s2/n); upone=xbar+t1*sqrt(s2/n); lobon=xbar-tb*sqrt(s2/n); upbon=xbar+tb*sqrt(s2/n); losim=xbar-sqrt(&p*(n-1)*f*s2/(n-&p)/n); upsim=xbar+sqrt(&p*(n-1)*f*s2/(n-&p)/n); run; proc print data=b; run;