RENAME VARIABLES

As explained in the "Get File" and "Save File" chapters, existing variables can be renamed either when retrieving or saving data. However, you may wish to change a variable name in your present working file. This can easily be achieved with the "rename variable" command.

RENAME VARIABLE (varx = vara).

This command changes the name of the variable on the left hand of the equals sign into the name on the right hand. Actually, several variables may be addressed with one command; all old variable names must appear on the left hand of the equals sign, and the appropriate number of new variable names on the right hand. The first variable listed on the left hand will get the first name listed on the right hand of the equals sign, and so forth, such as in:

REN VAR (varx var17 income = vara varb nincome).

Note that the order of the variables on the left hand does not have to correspond to the ordering of the variables in the data set.

If a name of an existing variable is listed on the right hand of the equals sign, the RENAME VARIABLE command will not be executed. However, you may exchange the names of two (or probably more) variables, such as in

REN VAR (vara varc = varc vara).

© W. Ludwig-Mayerhofer, IGSW | Last update: 26 Apr 2002