DBCONDITION= Data Set Option

Specifies criteria for subsetting and ordering DBMS data.
Valid in: DATA and PROC steps (when accessing DBMS data using SAS/ACCESS software)
Default: none
Restrictions: 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.

Data source: Aster nCluster, DB2 under UNIX and PC Hosts, DB2 under z/OS, Greenplum, HP Neoview, Informix, Microsoft SQL Server, MySQL, Netezza, ODBC, OLE DB, Oracle, Sybase, Sybase IQ, Teradata
See: DBINDEX= data set option, DBKEY= data set option

Syntax

DBCONDITION="DBMS-SQL-query-clause"

Syntax Description

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

Details

You can use this option to specify selection criteria in the form of DBMS-specific SQL query clauses, which the SAS/ACCESS engine passes 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.

Example: Return Only Condition-Specific Rows

In this example, the function that is passed to the DBMS with the DBCONDITION= option causes the DBMS to return to SAS only those 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;