DROP and KEEP Subcommands (IMPORT command)

DROP and KEEP are used to read a subset of variables from the portable file.

  • DROP excludes a variable or list of variables from the active dataset. All variables not named are included in the file.
  • KEEP includes a variable or list of variables in the active dataset. All variables not specified on KEEP are excluded.
  • DROP and KEEP cannot precede the FILE or TYPE subcommands.
  • Variables can be specified in any order. The order of variables on KEEP determines the order of variables in the active dataset. The order on DROP does not affect the order of variables in the active dataset.
  • If a variable is referred to twice on the same subcommand, only the first mention is recognized.
  • Multiple DROP and KEEP subcommands are allowed; the effect is cumulative. Specifying a variable named on a previous DROP or not named on a previous KEEP results in an error and the command is not executed.
  • The keyword TO can be used to specify a group of consecutive variables in the portable file.
  • The portable file is not affected by DROP or KEEP.

Example

IMPORT FILE='/data/newsum.por' 
  /DROP=DEPT TO DIVISION.
  • The active dataset is generated from the portable file newsum.por. Variables between and including DEPT and DIVISION in the portable file are excluded from the active dataset.
  • All other variables are copied into the active dataset.