DBCONDITION= Data Set Option

Specifies criteria for subsetting and ordering DBMS data.
Valid in: DATA and PROC steps
Supports: All

Syntax

DBCONDITION="DBMS-SQL-query-clause"

Syntax Description

DBMS-SQL-query-clause
is a DBMS-specific SQL query clause, such as WHERE, GROUP BY, HAVING, or ORDER BY.

Details

This option enables you to specify selection criteria in the form of DBMS-specific SQL query clauses, which are passed directly to the DBMS for processing. When selection criteria are passed directly to the DBMS for processing, performance is often enhanced. The DBMS checks the criteria for syntax errors when it receives the SQL query.
The DBKEY= and DBINDEX= options are ignored when you use DBCONDITION=. DBCONDITION= is ignored if it specifies ORDER BY and you also use a BY statement.

Example: Return Only Condition-Specific Rows

In the following example, the function that is passed to the DBMS with the DBCONDITION= option causes the DBMS to return to SAS only the rows that satisfy the condition.
proc sql;
   create view smithnames as
      select lastname from myoralib.employees
             (dbcondition="where soundex(lastname) = soundex('SMYTHE')" )
              using libname myoralib oracle user=testuser pw=testpass path=dbmssrv;
select lastname from smithnames;