ACCESS Procedure

SUBSET Statement

Adds or modifies selection criteria for a view descriptor

Restriction: The SUBSET statement is case sensitive, unlike other ACCESS procedure statements. The SQL statement is sent to the DBMS exactly as you enter it. You must therefore use the correct case for any DBMS object names. For details, see the DBMS-specific information for your SAS/ACCESS interface.
Interactions: applies to view descriptors
If you specify more than one SUBSET statement per view descriptor, the last SUBSET overwrites the earlier SUBSETs.
Notes: This statement is optional.
SAS does not check the SUBSET statement for errors. The statement is verified only when the view descriptor is used in a SAS program.
Tips: You can use the SUBSET statement to specify selection criteria when you create a view descriptor.
If you omit it, the view retrieves all data (rows) in the DBMS table.
To delete the selection criteria, submit a SUBSET statement without any arguments.
Example: For a view descriptor that retrieves rows from a DBMS table, you could submit this statement:
subset where firstorder is not null;

Syntax

Required Argument

selection-criteria

one or more DBMS-specific SQL expressions that are accepted by your DBMS, such as WHERE, ORDER BY, HAVING, and GROUP BY. Use DBMS column names, not SAS variable names, in your selection criteria.

Details

If you have multiple selection criteria, enter them all in one SUBSET statement, as shown in this example:

subset where firstorder is not null
  and country = 'USA'
  order by country;
Last updated: February 3, 2026