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)
Category: Data Set Control
Default: none
Restrictions: The DBKEY= and DBINDEX= options are ignored when you use DBCONDITION=.
Hadoop, JDBC: DBCONDITION= is ignored if it specifies ORDER BY and you also use a BY statement.
Data source: Amazon Redshift, Aster, DB2 under UNIX and PC Hosts, DB2 under z/OS, Google BigQuery, Greenplum, Hadoop, HAWQ, Impala, Informix, JDBC, Microsoft SQL Server, MySQL, Netezza, ODBC, OLE DB, Oracle, PostgreSQL, SAP ASE, SAP HANA, SAP IQ, Snowflake, Teradata, Vertica, Yellowbrick
Note: Support for Yellowbrick was added in SAS 9.4M7.
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

When you use this option to specify selection criteria in the form of DBMS-specific SQL query clauses, performance is often enhanced because the SAS/ACCESS engine passes these clauses directly to the DBMS for processing. 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=myusr1
                    pw=mypwd1 path=mysrv1;
select lastname from smithnames;
Last updated: February 3, 2026