DROP and KEEP Subcommands (VARSTOCASES command)
The DROP
and KEEP
subcommands are used to include only
a subset of variables in the new active dataset. The DROP
subcommand specifies a set of variables
to exclude and the KEEP
subcommand
specifies a set of variables to retain. Variables not specified on
the KEEP
subcommand are dropped.
-
DROP
andKEEP
cannot be used with variables that appear on aFROM
list. -
DROP
andKEEP
are mutually exclusive. Only oneDROP
or oneKEEP
subcommand can be used on theVARSTOCASES
command. -
KEEP
affects the order of variables in the new data file. The order of the variables kept in the new data file is the order in which they are named on theKEEP
subcommand.
Example
VARSTOCASES
/MAKE newvar FROM var1 to var4
/DROP caseid.
- Caseid is dropped from the new data file. The new data file contains one variable, newvar.