Overview (RENAME VARIABLES command)

RENAME VARIABLES changes the names of variables in the active dataset while preserving their original order, values, variable labels, value labels, missing values, and print and write formats.

Basic Specification

  • The basic specification is an old variable name, an equals sign, and the new variable name. The equals sign is required.

Syntax Rules

  • Multiple sets of variable specifications are allowed. Each set can be enclosed in parentheses.
  • You can specify 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. A single set of parentheses enclosing the entire specification is required for this method.
  • Keyword TO can be used on the left side of the equals sign to refer to variables in the active dataset, and on the right side of the equals sign to generate new variable names.
  • 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 VARIABLES commands are allowed.
  • RENAME VARIABLES cannot follow either a TEMPORARY or a MODEL PROGRAM command.