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 and KEEP cannot be used with variables that appear on a FROM list.
  • DROP and KEEP are mutually exclusive. Only one DROP or one KEEP subcommand can be used on the VARSTOCASES 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 the KEEP 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.