Previous Page | Next Page

SAS Data Set Options

WHERE= Data Set Option



Specifies specific conditions to use to select observations from a SAS data set.
Valid in: DATA step and PROC steps
Category: Observation Control
Restriction: Cannot be used with the POINT= option in the SET and MODIFY statements.

Syntax
Syntax Description
Details
Comparisons
Examples
Example 1: Selecting Observations from an Input Data Set
Example 2: Selecting Observations from an Output Data Set
See Also

Syntax

WHERE=(where-expression-1<logical-operator where-expression-n>)


Syntax Description

where-expression

is an arithmetic or logical expression that consists of a sequence of operators, operands, and SAS functions. An operand is a variable, a SAS function, or a constant. An operator is a symbol that requests a comparison, logical operation, or arithmetic calculation. The expression must be enclosed in parentheses.

logical-operator

can be AND, AND NOT, OR, or OR NOT.


Details

Note:   Using indexed SAS data sets can improve performance significantly when you are using WHERE expressions to access a subset of the observations in a SAS data set. See Understanding SAS Indexes in SAS Language Reference: Concepts for a complete discussion of WHERE expression processing with indexed data sets and a list of guidelines to consider before indexing your SAS data sets.  [cautionend]


Comparisons


Examples


Example 1: Selecting Observations from an Input Data Set

This example uses the WHERE= data set option to subset the SALES data set as it is read into another data set:

data whizmo;
   set sales(where=(product='whizmo'));
run;


Example 2: Selecting Observations from an Output Data Set

This example uses the WHERE= data set option to subset the SALES output data set:

data whizmo(where=(product='whizmo'));
   set sales;
run;


See Also

Statements:

WHERE Statement

WHERE-Expression Processing in SAS Language Reference: Concepts

Previous Page | Next Page | Top of Page