As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

# MEANS procedure

*This is a work in progress. You can contribute to this article.*

The **MEANS procedure** computes of a variety of statistical measures across all or groups of observations in a dataset.

Various options in the *MEANS procedure* make it possible to report statistics of zero (0) where no observations exist in the source, without needing to generate a cartesian product of the desired reporting categories.

The *MEANS procedure* is very similar to the SUMMARY procedure. The main difference between the two procedures is how they behave if the VAR statement is omitted. In the *MEANS procedure*, if the *VAR statement* is omitted then the procedure attempts to produces statistics for all numeric variables in the dataset. If all variables are categorical (character or alphnumeric) then a count of observations is produced.

## Contents

## Syntax

**PROC****MEANS***<options>**<statistics keyword(s)>***;***RUN statement**;*

- Note
- Statements shown in
*italics*are optional. Not all statements are necessary and some statements may be omitted or statement order may be changed. This could affect the behaviour of the procedure.

### Options

- PROC MEANS <option(s)> <statistic-keyword(s)>;

#### Procedure options

#### Statistics keywords

### Statement details

- BY <DESCENDING> variable-1<…<DESCENDING> variable-n> <NOTSORTED>;
- CLASS variable(s) </ option(s)>;
- FREQ variable;
- ID variable(s);
- OUTPUT <OUT=SAS-data-set><output-statistic-specification(s)> <id-group-specification(s)> <maximum-id-specification(s)> <minimum-id-specification(s)> </ option(s)> ;
- TYPES request(s);
- VAR variable(s)</ WEIGHT=weight-variable>;
- WAYS list;
- WEIGHT variable;

## Usage

The MEANS procedure is a computationally intensive procedure and has the potential to run for a long time, consume all available memory and produce large output datatsets, depending on the options chosen, even with a comparatively small input dataset.

## See also

- Beware Missing Values of Class Levels in PROC MEANS
- The Essential Meaning of PROC MEANS: A Beginner's Guide to Summarizing Data Using SAS® Software
- Adding statistics to the PROC MEANS/SUMMARY default output dataset.
- FREQ and WEIGHT Statements
- Missing Values in Classification Variables
- PROC MEANS - Improve on the default
- PROC MEANS ignores format widths in output
- Replacing Missing with Mean
- Statistical Models for Identifying Aberrant Utilization Patterns

## Further reading

### SAS Documentation

Base SAS® Procedures Guide - MEANS Procedure : Versions: 9.1.3 (PDF), 9.2 (PDF), 9.3, 9.4