The MEANS Procedure

# Overview

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

• 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 The SUMMARY Procedure for an explanation of the differences.

The Default Descriptive Statistics 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;```

Specified Statistics for Class Levels and Identification of Maximum Values 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 .

 ``` 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 110 Willard Tonya 78.65 40 2 26 1 1 . . 3 1992 1 31 Tonya Tonya 55.16 40 4 1993 1 32 Cameron Amy 65.44 31 5 1994 1 46 Willard L.T. 78.65 33 6 47.33 . 2 1 . . 7 Kennedy . 2 53 Luther Jay 72.22 35 8 Monroe . 2 56 Willard Tonya 78.65 40 9 47.33 26 3 1 . . 10 Kennedy 1992 3 15 Thelma Jay 52.63 35 11 Kennedy 1993 3 20 Bill Amy 42.23 31 12 Kennedy 1994 3 18 Luther Che-Min 72.22 33 13 Monroe 1992 3 16 Tonya Tonya 55.16 40 14 Monroe 1993 3 12 Cameron Tyra 65.44 23 15 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.