/* Example SAS code for calculating confidence intervals for the population mean */ OPTIONS pagesize=50 linesize=64; /* (setting the page margins) */ /* The MEANS procedure with CLM computes confidence intervals for mu */ /* Consider an example in which we had data on weights of newborn babies */ /* The following code will enter 9 data points (weights for 9 babies) */ /* and give us a confidence interval for the population mean weight */ data babywt; input weight; cards; 7.5 8 6 5.6 9.1 6.7 7 7.8 9.6 ; run; proc means data=babywt clm; var weight; title '95 percent CI for population mean weight'; run; /* 95 percent is the default confidence level */ /* What if we wanted a 99 percent CI? Then we specify alpha=0.01: */ proc means data=babywt clm alpha=0.01; var weight; title '99 percent CI for population mean weight'; run; /* After we input this program into the program editor and do "Run"->"Submit" */ /* Then the results print in the Output window (across multiple pages) */ /* To save paper when printing out results, copy the Output and paste it into */ /* something like Word or Notepad */ /* Notice in SAS we input the actual data, whereas in class we started with the */ /* sample statistics x-bar and s. */