Next: , Previous: , Up: Manipulating Variables   [Contents][Index]


11.4 MODIFY VARS

You can use MODIFY VARS to reorder, rename, or delete variables.

MODIFY VARS
        /REORDER={FORWARD,BACKWARD} {POSITIONAL,ALPHA} (var_list)…
        /RENAME=(old_names=new_names)…
        /{DROP,KEEP}=var_list
        /MAP

At least one subcommand must be specified, and no subcommand may be specified more than once. DROP and KEEP may not both be specified.

The REORDER subcommand changes the order of variables in the active dataset. Specify one or more lists of variable names in parentheses. By default, each list of variables is rearranged into the specified order. To put the variables into the reverse of the specified order, put keyword BACKWARD before the parentheses. To put them into alphabetical order in the dictionary, specify keyword ALPHA before the parentheses. BACKWARD and ALPHA may also be combined.

To rename variables in the active dataset, specify RENAME, an equals sign (‘=’), and lists of the old variable names and new variable names separated by another equals sign within parentheses. There must be the same number of old and new variable names. Each old variable is renamed to the corresponding new variable name. Multiple parenthesized groups of variables may be specified.

The DROP subcommand deletes a specified list of variables from the active dataset. MODIFY VARS may not be used to delete all variables from the dictionary; use NEW FILE to do that (see NEW FILE).

The KEEP subcommand keeps the specified list of variables in the active dataset. Any unlisted variables are deleted from the active dataset.

MAP is currently ignored.

If either DROP or KEEP is specified, the data is read; otherwise it is not.

MODIFY VARS may not be specified following TEMPORARY (see TEMPORARY).


Next: RENAME VARIABLES, Previous: STRING, Up: Manipulating Variables   [Contents][Index]