Previous Page | Next Page

SAS Data Set Options

DROP= Data Set Option



For an input data set, excludes the specified variables from processing; for an output data set, excludes the specified variables from being written to the data set.
Valid in: DATA step and PROC steps
Category: Variable Control

Syntax
Syntax Description
Details
Comparisons
Examples
Example 1: Excluding Variables from Input
Example 2: Processing Variables without Writing Them to a Data Set
See Also

Syntax

DROP=variable-1 <...variable-n>


Syntax Description

variable-1 <...variable-n>

lists one or more variable names. You can list the variables in any form that SAS allows.


Details

If the option is associated with an input data set, the variables are not available for processing. If the DROP= data set option is associated with an output data set, SAS does not write the variables to the output data set, but they are available for processing.


Comparisons


Examples


Example 1: Excluding Variables from Input

In this example, the variables SALARY and GENDER are not included in processing and they are not written to either output data set:

data plan1 plan2;
   set payroll(drop=salary gender);
   if hired<'01jan98'd then output plan1;
   else output plan2;
run;

You cannot use SALARY or GENDER in any logic in the DATA step because DROP= prevents the SET statement from reading them from PAYROLL.


Example 2: Processing Variables without Writing Them to a Data Set

In this example, SALARY and GENDER are not written to PLAN2, but they are written to PLAN1:

data plan1 plan2(drop=salary gender);
   set payroll; 
   if hired<'01jan98'd then output plan1;
   else output plan2;
run;


See Also

Data Set Options:

KEEP= Data Set Option

Statements:

DROP Statement

Previous Page | Next Page | Top of Page