DROP and KEEP Subcommands (EXPORT command)

DROP and KEEP save a subset of variables in the portable file.

  • DROP excludes a variable or list of variables from the portable file. All variables not named are included in the portable file.
  • KEEP includes a variable or list of variables in the portable file. All variables not named are excluded.
  • Variables can be specified on DROP and KEEP in any order. With the DROP subcommand, the order of variables in the portable file is the same as their order in the active dataset. With the KEEP subcommand, the order of variables in the portable file is the order in which they are named on KEEP. Thus, KEEP can be used to reorder variables in the portable file.
  • Both DROP and KEEP can be used on the same EXPORT command; the effect is cumulative. If you specify a variable already named on a previous DROP or one not named on a previous KEEP, the variable is considered nonexistent and the program displays an error message. The command is aborted and no portable file is saved.

Example

EXPORT OUTFILE=NEWSUM /DROP=DEPT TO DIVISION.
  • The portable file is written to file NEWSUM. Variables between and including DEPT and DIVISION in the active dataset are excluded from the portable file.
  • All other variables are saved in the portable file.