RENAME Subcommand (XSAVE command)
RENAME
changes
the names of variables as they are copied into the new data 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. KeywordTO
can be used on the first list to refer to consecutive variables in the active dataset and on 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.
-
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
XSAVE OUTFILE='/data/empl88.sav'
/RENAME AGE=AGE88 JOBCAT=JOBCAT88.
CROSSTABS DEPT85 TO DEPT88 BY JOBCAT.
-
RENAME
specifies two name changes for file empl88.sav: AGE is renamed to AGE88 and JOBCAT is renamed to JOBCAT88.XSAVE OUTFILE='/data/empl88.sav' /RENAME (AGE JOBCAT=AGE88 JOBCAT88). CROSSTABS DEPT85 TO DEPT88 BY JOBCAT.
- The name changes are identical to those in the previous example: AGE is renamed to AGE88 and JOBCAT is renamed to JOBCAT88. The parentheses are required with this method.