Previous Page | Next Page

SAS Data Set Options

KEEP= Data Set Option



For an input data set, specifies the variables to process; for an output data set, specifies the variables to write to the data set.
Valid in: DATA step and PROC steps
Category: Variable Control

Syntax
Syntax Description
Details
Comparisons
Example
See Also

Syntax

KEEP=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 KEEP= data set option is associated with an input data set, only those variables that are listed after the KEEP= data set option are available for processing. If the KEEP= data set option is associated with an output data set, only the variables listed after the option are written to the output data set, but all variables are available for processing.


Comparisons


Example

In this example, only IDNUM and SALARY are read from PAYROLL, and they are the only variables in PAYROLL that are available for processing:

data bonus;
   set payroll(keep=idnum salary);
   bonus=salary*1.1;
run;


See Also

Data Set Options:

DROP= Data Set Option

Statements:

KEEP Statement

Previous Page | Next Page | Top of Page