NEWNAMES Subcommand (FLIP command)
NEWNAMES
specifies a variable whose values are used as the new variable names.
- The
NEWNAMES
subcommand is optional. If it is not used, the new variable names are either VAR001 to VARn, or the values of CASE_LBL if it exists. - Only one variable can be specified on
NEWNAMES
. - The variable specified on
NEWNAMES
does not become an observation (case) in the new active dataset, regardless of whether it is specified on theVARIABLES
subcommand. - If the variable specified is numeric, its values become a character string beginning with the prefixK_.
- Characters not allowed in variables names, such as blank spaces, are replaced with underscore (_) characters.
- If the variable’s values are not unique, unique variable names are created by appending a sequential suffix of the general form _A, _B, _C,..._AA, _AB, _AC,..._AAA, _AAB, _AAC,...etc.
Example
Using the untransposed file from the first example, the command
FLIP NEWNAMES=A.
uses the values for variable A as variable names in the new file. The LIST
output for the transposed file is as
follows:
CASE_LBL INCOME PRICE YEAR
B 22.00 34.00 1970.00
C 31.00 29.00 1971.00
D 43.00 50.00 1972.00
- Variable A does not become an observation in the new file. The string values for A are converted to upper case.
The following command transposes this file back to a form resembling its original structure:
FLIP.
The LIST
output
for the transposed file is as follows:
CASE_LBL B C D
INCOME 22.00 31.00 43.00
PRICE 34.00 29.00 50.00
YEAR 1970.00 1971.00 1972.00
- Since the
NEWNAMES
subcommand is not used, the values of CASE_LBL from the previousFLIP
(B, C, and D) are used as variable names in the new file. - The values of CASE_LBL are now INCOME, PRICE, and YEAR.