MEANS Procedure

Overview: MEANS Procedure

What Does the MEANS Procedure Do?

The MEANS procedure provides data summarization tools to compute descriptive statistics for variables across all observations and within groups of observations. For example, PROC MEANS does the following:
  • calculates descriptive statistics based on moments
  • estimates quantiles, which includes the median
  • calculates confidence limits for the mean
  • identifies extreme values
  • performs a t test
By default, PROC MEANS displays output. You can also use the OUTPUT statement to store the statistics in a SAS data set.
PROC MEANS and PROC SUMMARY are very similar; see SUMMARY Procedure for an explanation of the differences.

What Types of Output Does PROC MEANS Produce?

PROC MEANS Default Output

The following output shows the default output that PROC MEANS displays. The data set that PROC MEANS analyzes contains the integers 1 through 10. The output reports the number of observations, the mean, the standard deviation, the minimum value, and the maximum value. The statements that produce the output follow:
proc means data=OnetoTen;
run;
The Default Descriptive Statistics
                                 The SAS System                                1

                              The MEANS Procedure

                          Analysis Variable : Integer

        N            Mean         Std Dev         Minimum         Maximum
----------------------------------------------------------------------------------
       10       5.5000000       3.0276504       1.0000000      10.0000000
----------------------------------------------------------------------------------

PROC MEANS Customized Output

The following output shows the results of a more extensive analysis of two variables, MoneyRaised and HoursVolunteered. The analysis data set contains information about the amount of money raised and the number of hours volunteered by high-school students for a local charity. PROC MEANS uses six combinations of two categorical variables to compute the number of observations, the mean, and the range. The first variable, School, has two values and the other variable, Year, has three values. For an explanation of the program that produces the output, see Identifying an Extreme Value with the Output Statistics.
Specified Statistics for Class Levels and Identification of Maximum Values
                 Summary of Volunteer Work by School and Year                 1

                              The MEANS Procedure

                          N
 School           Year  Obs  Variable            N          Mean         Range
 -----------------------------------------------------------------------------
 Kennedy          1992   15  MoneyRaised        15    29.0800000    39.7500000
                             HoursVolunteered   15    22.1333333    30.0000000

                  1993   20  MoneyRaised        20    28.5660000    23.5600000
                             HoursVolunteered   20    19.2000000    20.0000000

                  1994   18  MoneyRaised        18    31.5794444    65.4400000
                             HoursVolunteered   18    24.2777778    15.0000000

 Monroe           1992   16  MoneyRaised        16    28.5450000    48.2700000
                             HoursVolunteered   16    18.8125000    38.0000000

                  1993   12  MoneyRaised        12    28.0500000    52.4600000
                             HoursVolunteered   12    15.8333333    21.0000000

                  1994   28  MoneyRaised        28    29.4100000    73.5300000
                             HoursVolunteered   28    19.1428571    26.0000000

-----------------------------------------------------------------------------
             Best Results: Most Money Raised and Most Hours Worked             2

                                       Most     Most      Money     Hours
   Obs  School   Year  _TYPE_  _FREQ_  Cash     Time     Raised  Volunteered

     1              .     0      109   Willard  Tonya     78.65       40
     2           1992     1       31   Tonya    Tonya     55.16       40
     3           1993     1       32   Cameron  Amy       65.44       31
     4           1994     1       46   Willard  L.T.      78.65       33
     5  Kennedy     .     2       53   Luther   Jay       72.22       35
     6  Monroe      .     2       56   Willard  Tonya     78.65       40
     7  Kennedy  1992     3       15   Thelma   Jay       52.63       35
     8  Kennedy  1993     3       20   Bill     Amy       42.23       31
     9  Kennedy  1994     3       18   Luther   Che-Min   72.22       33
    10  Monroe   1992     3       16   Tonya    Tonya     55.16       40
    11  Monroe   1993     3       12   Cameron  Myrtle    65.44       26
    12  Monroe   1994     3       28   Willard  L.T.      78.65       33
In addition to the report, the program also creates an output data set (located on page 2 of the output) that identifies the students who raised the most money and who volunteered the most time over all the combinations of School and Year and within the combinations of School and Year:
  • The first observation in the data set shows the students with the maximum values overall for MoneyRaised and HoursVolunteered.
  • Observations 2 through 4 show the students with the maximum values for each year, regardless of school.
  • Observations 5 and 6 show the students with the maximum values for each school, regardless of year.
  • Observations 7 through 12 show the students with the maximum values for each school-year combination.