TRANSPOSE Procedure

PROC TRANSPOSE Statement

Creates an output data set by restructuring the values in a SAS data set, transposing selected variables into observations.
Tip: You can use data set options with the DATA= and OUT= options. For more information, see Statements with the Same Function in Multiple Procedures. You can also use any global statement. For a list, see Global Statements in SAS Statements: Reference.
Performing a Simple Transposition

Naming Transposed Variables

Labeling Transposed Variables

Transposing BY Groups

Naming Transposed Variables When the ID Variable Has Duplicate Values

Transposing Data for Statistical Analysis

Syntax

Optional Arguments

DATA= input-data-set
names the SAS data set to transpose.
Default:most recently created SAS data set
DELIMITER= delimiter
specifies a delimiter to use in constructing names for transposed variables in the output data set. If specified, the delimiter will be inserted between variable values if more than one variable has been specified in the ID statement.
Alias:DELIM=
Tip:You can use name literals (n-literals) for the value of DELIMITER. Name literals are helpful when specifying typographical or foreign characters, especially when VALIDVARNAME=ANY.
LABEL= label
specifies a name for the variable in the output data set that contains the label of the variable that is being transposed to create the current observation.
Default:_LABEL_
Tip:You can use name literals (n-literals) for the value of LABEL. Name literals are helpful when specifying typographical or foreign characters, especially when VALIDVARNAME=ANY.
LET
allows duplicate values of an ID variable. PROC TRANSPOSE transposes the observation that contains the last occurrence of a particular ID value within the data set or BY group.
NAME= name
specifies the name for the variable in the output data set that contains the name of the variable that is being transposed to create the current observation.
Default:_NAME_
OUT= output-data-set
names the output data set. If output-data-set does not exist, then PROC TRANSPOSE creates it by using the DATAn naming convention.
PREFIX= prefix
specifies a prefix to use in constructing names for transposed variables in the output data set. For example, if PREFIX=VAR, then the names of the variables are VAR1, VAR2, …,VARn.
Interaction:When you use PREFIX= with an ID statement, the variable name begins with the prefix value followed by the ID value.
Tip:You can use name literals (n-literals) for the value of PREFIX. Name literals are helpful when specifying typographical or foreign characters, especially when VALIDVARNAME=ANY.
SUFFIX= suffix
specifies a suffix to use in constructing names for transposed variables in the output data set.
Interaction:When you use SUFFIX= with an ID statement, the value is appended to the ID value.
Tip:You can use name literals (n-literals) for the value of SUFFIX. Name literals are helpful when specifying typographical or foreign characters, especially when VALIDVARNAME=ANY.