RENAME Subcommand (ADD FILES command)
RENAME renames
variables in input files before they are processed by ADD FILES. RENAME follows the FILE subcommand that specifies the file
containing the variables to be renamed.
-
RENAMEapplies only to theFILEsubcommand immediately preceding it. To rename variables from more than one input file, enter aRENAMEsubcommand after eachFILEsubcommand that specifies a file with variables to be renamed. - Specifications for
RENAMEconsist of a left parenthesis, a list of old variable names, an equals sign, a list of new variable names, and a right parenthesis. The two variable lists must name or imply the same number of variables. If only one variable is renamed, the parentheses are optional. - More than one such specification can be entered on
a single
RENAMEsubcommand, each enclosed in parentheses. - The
TOkeyword can be used to refer to consecutive variables in the file and to generate new variable names. -
RENAMEtakes effect immediately.KEEPandDROPsubcommands entered prior toRENAMEmust use the old names, while those entered afterRENAMEmust use the new names. - All specifications within a single set of parentheses
take effect simultaneously. For example, the specification
RENAME (A,B = B,A)swaps the names of the two variables. - Variables cannot be renamed to scratch variables.
- Input data files are not changed on disk; only the copy of the file being combined is affected.
Example
ADD FILES FILE="/data/clients.sav" /RENAME=(TEL_NO, ID_NO = PHONE, ID)
/FILE="/data/primary.sav" /BY ID.
-
ADD FILESadds new client cases from the file clients.sav to existing client cases in the file primary.sav. - Two variables on clients.sav are renamed prior to the match. TEL_NO is renamed
PHONE to match the name used for phone numbers in the primary file. ID_NO is renamed
ID so that it will have the same name as the identification variable in the primary file and
can be used on the
BYsubcommand. - The
BYsubcommand orders the resulting file according to client ID number.