MEANS Procedure

ID Statement

Includes additional variables in the output data set.
See: Discussion of id-group-specification in OUTPUT Statement.

Syntax

Required Argument

variable(s)
identifies one or more variables from the input data set whose maximum values for groups of observations PROC MEANS includes in the output data set.
Interaction:Use IDMIN in the PROC statement to include the minimum value of the ID variables in the output data set.
Tip:Use the PRINTIDVARS option in the PROC statement to include the value of the ID variable in the displayed output.

Details

Selecting the Values of the ID Variables

When you specify only one variable in the ID statement, the value of the ID variable for a given observation is the maximum (minimum) value found in the corresponding group of observations in the input data set. When you specify multiple variables in the ID statement, PROC MEANS selects the maximum value by processing the variables in the ID statement in the order in which you list them. PROC MEANS determines which observation to use from all the ID variables by comparing the values of the first ID variable. If more than one observation contains the same maximum (minimum) ID value, then PROC MEANS uses the second and subsequent ID variable values as “tiebreakers.” In any case, all ID values are taken from the same observation for any given BY group or classification level within a type.
See Sorting Orders for Character Variables for information about how PROC MEANS compares character values to determine the maximum value.