PROC TRANSPOSE does not transpose BY groups. Instead,
for each BY group, PROC TRANSPOSE creates one observation for each
variable that it transposes.
The following figure
shows what happens when you transpose a data set with BY groups. TYPE
is the BY variable, and SOLD, NOTSOLD, REPAIRED, and JUNKED are the
variables to transpose.
-
The number of observations in the
output data set (12) is the number of BY groups (3) multiplied by
the number of variables that are transposed (4).
-
The BY variable is not transposed.
-
_NAME_ contains the name of the
variable in the input data set that was transposed to create the current
observation in the output data set. You can use the NAME= option to
specify another name for the _NAME_ variable.
-
The maximum number of observations
in any BY group in the input data set is two. Therefore, the output
data set contains two variables, COL1 and COL2. COL1 and COL2 contain
the values of SOLD, NOTSOLD, REPAIRED, and JUNKED.
Note: If a BY group in the input
data set has more observations than other BY groups, then PROC TRANSPOSE
assigns missing values in the output data set to the variables that
have no corresponding input observations.