Chapter Contents

Previous

Next
The TRANSPOSE Procedure

ID Statement


Specifies a variable in the input data set whose formatted values name the transposed variables in the output data set.

Featured in: Naming Transposed Variables
Restriction: You cannot use PROC TRANSPOSE with an ID statement or a BY statement with an engine that supports concurrent access if another user is updating the data set at the same time.


ID variable;


Required Argument

variable
names the variable whose formatted values name the transposed variables.


Duplicate ID Values
Typically, each formatted ID value occurs only once in the input data set or, if you use a BY statement, only once within a BY group. Duplicate values cause PROC TRANSPOSE to issue a warning message and stop. However, if you use the LET option in the PROC TRANSPOSE statement, the procedure issues a warning message about duplicate ID values and transposes the observation containing the last occurrence of the duplicate ID value.


Making Variable Names Out of Numeric Values
When you use a numeric variable as an ID variable, PROC TRANSPOSE changes the formatted ID value into a valid SAS name.

However, SAS variable names cannot begin with a number. Thus, when the first character of the formatted value is numeric, the procedure prefixes an underscore to the value, truncating the last character of an 32-character value. Any remaining invalid characters are replaced by underscores. The procedure truncates to 32 characters any ID value that is longer than 32 characters when it uses that value to name a transposed variable.

If the formatted value looks like a numeric constant, PROC TRANSPOSE changes the characters '+', '-', and '.' to 'P','N', and 'D', respectively. If the formatted value has characters that are not numerics, PROC TRANSPOSE changes the characters '+', '-', and '.' to underscores.

Note:   If the value of the VALIDVARNAME system option is V6, PROC TRANSPOSE truncates transposed variable names to eight characters.  [cautionend]


Missing Values
If you use an ID variable that contains a missing value, PROC TRANSPOSE writes an error message to the log. The procedure does not transpose observations that have a missing value for the ID variable.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.