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 onKEEP
are excluded. -
DROP
andKEEP
cannot precede theFILE
orTYPE
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 onDROP
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
andKEEP
subcommands are allowed; the effect is cumulative. Specifying a variable named on a previousDROP
or not named on a previousKEEP
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
orKEEP
.
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.