27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

DROP and KEEP Subcommands<br />

EXPORT 533<br />

DROP and KEEP save a subset of variables in the portable file.<br />

• DROP excludes a variable or list of variables from the portable file. All variables not<br />

named are included in the portable file.<br />

• KEEP includes a variable or list of variables in the portable file. All variables not named<br />

are excluded.<br />

• Variables can be specified on DROP and KEEP in any order. With the DROP subcommand,<br />

the order of variables in the portable file is the same as their order in the working file.<br />

With the KEEP subcommand, the order of variables in the portable file is the order in<br />

which they are named on KEEP. Thus, KEEP can be used to reorder variables in the<br />

portable file.<br />

• Both DROP and KEEP can be used on the same EXPORT command; the effect is cumulative.<br />

If you specify a variable already named on a previous DROP or one not named on a<br />

previous KEEP, the variable is considered nonexistent and the program displays an error<br />

message. The command is aborted and no portable file is saved.<br />

Example<br />

EXPORT OUTFILE=NEWSUM /DROP=DEPT TO DIVISION.<br />

• The portable file is written to file NEWSUM. Variables between and including DEPT and<br />

DIVISION in the working file are excluded from the portable file.<br />

• All other variables are saved in the portable file.<br />

RENAME Subcommand<br />

RENAME renames variables being written to the portable file. The renamed variables retain<br />

their original variable and value labels, missing-value flags, and print formats. The names of<br />

the variables are not changed in the working data file.<br />

• To rename a variable, specify the name of the variable in the working data file, an equals<br />

sign, and the new name.<br />

• A variable list can be specified on both sides of the equals sign. The number of variables on<br />

both sides must be the same, and the entire specification must be enclosed in parentheses.<br />

• The keyword TO can be used for both variable lists (see “Keyword TO” on p. 23).<br />

• If you specify a renamed variable on a subsequent DROP or KEEP subcommand, the new<br />

variable name must be used.<br />

Example<br />

EXPORT OUTFILE=NEWSUM /DROP=DEPT TO DIVISION<br />

/RENAME=(NAME,WAGE=LNAME,SALARY).<br />

• RENAME renames NAME and WAGE to LNAME and SALARY.<br />

• LNAME and SALARY retain the variable and value labels, missing-value flags, and print<br />

formats assigned to NAME and WAGE.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!