ACCESS Procedure

SUBSET Statement

Adds or modifies selection criteria for a view descriptor


Required Argument

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.


You can use the SUBSET statement to specify selection criteria when you create a view descriptor. This statement is optional. If you omit it, the view retrieves all data (rows) in the DBMS table.
For example, you could submit the following SUBSET statement for a view descriptor that retrieves rows from a DBMS table:
subset where firstorder is not null;
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;
Unlike other ACCESS procedure statements, the SUBSET statement is case sensitive. The SQL statement is sent to the DBMS exactly as you enter it. Therefore, you must use the correct case for any DBMS object names. See SAS/ACCESS documentation for your DBMS for details.
SAS does not check the SUBSET statement for errors. The statement is verified only when the view descriptor is used in a SAS program.
If you specify more than one SUBSET statement per view descriptor, the last SUBSET overwrites the earlier SUBSETs. To delete the selection criteria, submit a SUBSET statement without any arguments.