Chapter Contents


SAS/CONNECT User's Guide

Syntax for the WHERE Statement

WHERE where-expression-1
<logical-operator where-expression-n>;

The UPLOAD procedure processes WHERE statements and the WHERE= data set option when you transfer a single SAS data set. WHERE statements allow multiple WHERE expressions that are joined by logical operators. logical-operator can be OR, OR NOT, AND, or AND NOT.

You can use SAS functions in a WHERE expression. Also, note that a DATA or a PROC step attempts to use an available index to optimize the selection of data when an indexed variable is used in combination with one of the following:

To understand when use of the SUBSTR function causes an index to be used, look at the format of the SUBSTR function in a WHERE statement:

where substr(variable, position, length)

An index is used in processing when all of the following conditions are met:

The following example illustrates using a WHERE statement with the UPLOAD procedure. The uploaded data set contains only the observations that meet the WHERE condition.

proc upload data=revenue out=new;
   where origin='Atlanta' and revenue < 10,000;

For more information about the WHERE statement, refer to SAS Language Reference: Dictionary.

Chapter Contents



Top of Page

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