MEANS Procedure

Example 7: Computing a Confidence Limit for the Mean

Features:
PROC MEANS statement options:
ALPHA=
FW=
MAXDEC=

CLASS statement

Data set: Charity

Details

This example does the following:
  • specifies the field width and number of decimal places of the statistics
  • computes a two-sided 90% confidence limit for the mean values of MoneyRaised and HoursVolunteered for the three years of data
If this data is representative of a larger population of volunteers, then the confidence limits provide ranges of likely values for the true population means.

Program

data charity;
   input School $ 1-7 Year 9-12 Name $ 14-20 MoneyRaised 22-26
         HoursVolunteered 28-29;
   datalines;
Monroe  2007 Allison 31.65 19
Monroe  2007 Barry   23.76 16
Monroe  2007 Candace 21.11  5


     . . . more data lines . . .

Kennedy 2009 Sid     27.45 25
Kennedy 2009 Will    28.88 21
Kennedy 2009 Morty   34.44 25
;
proc means data=charity fw=8 maxdec=2 alpha=0.1 clm mean std;
   class Year;
   var MoneyRaised HoursVolunteered;
   title 'Confidence Limits for Fund Raising Statistics';
   title2 '2007-09';
run;

Program Description

Create the CHARITY data set. CHARITY contains information about high-school students' volunteer work for a charity. The variables give the name of the high school, the year of the fund-raiser, the first name of each student, the amount of money each student raised, and the number of hours each student volunteered. A DATA step creates this data set.
data charity;
   input School $ 1-7 Year 9-12 Name $ 14-20 MoneyRaised 22-26
         HoursVolunteered 28-29;
   datalines;
Monroe  2007 Allison 31.65 19
Monroe  2007 Barry   23.76 16
Monroe  2007 Candace 21.11  5


     . . . more data lines . . .

Kennedy 2009 Sid     27.45 25
Kennedy 2009 Will    28.88 21
Kennedy 2009 Morty   34.44 25
;
Specify the analyses and the analysis options. FW= uses a field width of eight and MAXDEC= uses two decimal places to display the statistics. ALPHA=0.1 specifies a 90% confidence limit, and the CLM keyword requests two-sided confidence limits. MEAN and STD request the mean and the standard deviation, respectively.
proc means data=charity fw=8 maxdec=2 alpha=0.1 clm mean std;
Specify subgroups for the analysis. The CLASS statement separates the analysis by values of Year.
   class Year;
Specify the analysis variables. The VAR statement specifies that PROC MEANS calculate statistics on the MoneyRaised and HoursVolunteered variables.
   var MoneyRaised HoursVolunteered;
Specify the titles.
   title 'Confidence Limits for Fund Raising Statistics';
   title2 '2007-09';
run;

Output

PROC MEANS displays the lower and upper confidence limits for both variables for each year.
Confidence Limits
Confidence Limits for Fund Raising Statistics