Chapter Contents

Previous

Next
WHERE=

WHERE=



Selects observations that meet the specified condition

Valid in: DATA step and PROC steps
Category: Observation Control
Restriction: Cannot be used with the FIRSTOBS= and OBS= data set options or 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)

Syntax Description

where-expression
is an arithmetic or logical expression that consists of a sequence of operators, operands, and SAS functions. The expression must be enclosed in parentheses.


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 "SAS Indexes" in "SAS Data Files" 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

"WHERE Processing" in SAS Language Reference: Concepts


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.