WHERE Clause

Subsets the output based on specified conditions.

See: Joining Two Tables
Joining Three Tables

Syntax

WHERE sql-expression

Required Argument

sql-expression

Details

  • When a condition is met (that is, the condition resolves to true), those rows are displayed in the result table. Otherwise, no rows are displayed.
  • You cannot use summary functions that specify only one column.
    In this example, MAX is a summary function. Therefore, its context is that of a GROUP BY clause. It cannot be used to group, or summarize, data.
    where max(measure1) > 50;
    However, this WHERE clause will work.
    where max(measure1,measure2) > 50;
    In this case, MAX is a SAS function. It works with the WHERE clause because you are comparing the values of two columns within the same row. Consequently, it can be used to subset the data.