RENAME Subcommand (SAVE TRANSLATE command)
RENAME
changes
the names of variables as they are copied into the resulting file.
- The specification on
RENAME
is a list of old variable names followed by an equals sign and a list of new variable names. The same number of variables must be specified on both lists. The keywordTO
can be used in the first list to refer to consecutive variables in the active dataset and can be in the second list to generate new variable names. The entire specification must be enclosed in parentheses. - Alternatively, you can specify each old variable name individually, followed by an equals sign and the new variable name. Multiple sets of variable specifications are allowed. The parentheses around each set of specifications are optional.
- New names cannot exceed 64 bytes. Characters not allowed in IBM® SPSS® Statistics variable names can be used in new names for the target file, but if the name contains special characters (e.g., spaces, commas, slashes, plus signs) the name must be enclosed in quotes.
-
RENAME
does not affect the active dataset. However, ifRENAME
precedesDROP
orKEEP
, variables must be referred to by their new names onDROP
orKEEP
. - Old variable names do not need to be specified according to their order in the active dataset.
- Name changes take place in one operation. Therefore, variable names can be exchanged between two variables.
- Multiple
RENAME
subcommands are allowed.
Examples
SAVE TRANSLATE OUTFILE='STAFF.SYM' VERSION=2 /FIELDNAMES
/RENAME AGE=AGE88 JOBCAT=JOBCAT88.
-
RENAME
renames the variable AGE to AGE88 and renames JOBCAT to JOBCAT88 before they are copied to the first row of the spreadsheet.SAVE TRANSLATE OUTFILE='STAFF.SYM' VERSION=2 /FIELDNAMES /RENAME (AGE JOBCAT=AGE88 JOBCAT88).
- The name changes are identical to the changes in the previous example: AGE is renamed to AGE88, and JOBCAT is renamed to JOBCAT88. The parentheses are required with this method.