RENAME Subcommand (UPDATE command)
RENAME
renames
variables on the input files before they are processed by UPDATE
. RENAME
must follow the FILE
subcommand that contains the variables
to be renamed.
-
RENAME
applies only to the immediately precedingFILE
subcommand. To rename variables from more than one input file, specify aRENAME
subcommand after eachFILE
subcommand. - Specifications for
RENAME
consist 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 rename specification can be specified
on a single
RENAME
subcommand, each enclosed in parentheses. - The
TO
keyword can be used to refer to consecutive variables in the file and to generate new variable names. -
RENAME
takes effect immediately. AnyKEEP
andDROP
subcommands entered prior to aRENAME
must use the old names, whileKEEP
andDROP
subcommands entered after aRENAME
must 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.
Example
UPDATE FILE='/data/primary.sav' /FILE=CLIENTS
/RENAME=(TEL_NO, ID_NO = PHONE, ID)
/BY ID.
-
UPDATE
updates the primary phone list by using current information from the file CLIENTS. - Two variables on CLIENTS 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
BY
subcommand. - The old variable names are listed before the equals sign, and the new variable names are listed in the same order after the equals sign. The parentheses are required.
- The
BY
subcommand matches cases according to client ID numbers.