MEANS Procedure

BY Statement

Produces separate statistics for each BY group.
See: BY

Comparison of the BY and CLASS Statements

Using the BY Statement with Class Variables


Required Argument

specifies the variable that the procedure uses to form BY groups. You can specify more than one variable. If you omit the NOTSORTED option in the BY statement, then the observations in the data set either must be sorted by all the variables that you specify or must be indexed appropriately. Variables in a BY statement are called BY variables.

Optional Arguments

specifies that the observations are sorted in descending order by the variable that immediately follows the word DESCENDING in the BY statement.
specifies that observations are not necessarily sorted in alphabetic or numeric order. The observations are sorted in another way (for example, chronological order).
The requirement for ordering or indexing observations according to the values of BY variables is suspended for BY-group processing when you use the NOTSORTED option. The procedure does not use an index if you specify NOTSORTED. The procedure defines a BY group as a set of contiguous observations that have the same values for all BY variables. If observations with the same values for the BY variables are not contiguous, then the procedure treats each contiguous set as a separate BY group.


Using the BY Statement with the SAS System Option NOBYLINE

If you use the BY statement with the SAS system option NOBYLINE, which suppresses the BY line that normally appears in output that is produced with BY-group processing, then PROC MEANS always starts a new page for each BY group. This behavior ensures that if you create customized BY lines by putting BY-group information in the title and suppressing the default BY lines with NOBYLINE, then the information in the titles matches the report on the pages. See Creating Titles That Contain BY-Group Information . Also see Suppressing the Default BY Line.