/**t Confidence Interval for the Mean **/ /*********************************************************** Macro tint1 does 1 sample t confidence interval for the Mean. INPUT: dataset: input data set variable: variable to be analyzed level: confidence level OUTPUT: sample mean and confidence interval sample std dev and confidence interval ***********************************************************/ %macro tint1(dataset,variable,level); %let alpha2=%sysevalf(1-&level); proc ttest data=&dataset sides=2 alpha=&alpha2; var &variable; ods select conflimits; run; %mend tint1; /*********************************************************** Sample call: First submit the above macro code, then the code below. This first part reads in the LDL data from class. ***********************************************************/ data ldl; input decrease_ldl @@; cards; -7.6 13.9 27.1 14.8 6.3 42.0 41.7 18.5 31.2 24.0 ; run; /*********************************************************** And this is how the macro is called to get a 95% confidence interval. NOTE: This output also supplies a 95% confidence interval for the population standard deviation, something we haven't studied. ***********************************************************/ %tint1(ldl,decrease_ldl,.95);