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

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

SUMMARY procedure

From sasCommunity
Jump to: navigation, search
This is a work in progress. You can contribute to this article.

The SUMMARY procedure enables computation of a variety of statistical measures across all or groups of observations in a dataset.

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

The SUMMARY procedure is very similar to the MEANS procedure. The main difference between the two procedures is how they behave if the VAR statement is omitted. In the SUMMARY procedure, if the VAR statement is omitted then the procedure produces a count of observations in the dataset, by default, or else generates an error if any statistics keywords are specified in the procedure statement.


PROC SUMMARY <options> <statistics keyword(s)> ;
BY statement ;
CLASS statement ;
FREQ statement ;
ID statement ;
OUTPUT statement ;
TYPES statement ;
VAR statement ;
WAYS statement ;
WEIGHT statement ;
ATTRIB statement ;
FORMAT statement ;
LABEL statement ;
WHERE statement ;
<global statements> ;
RUN statement ;

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.


  • PROC SUMMARY <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;


The SUMMARY 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

Further reading

SAS Documentation

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