Specifying Subsetting Criteria
To
subset data based on a condition, use a WHERE clause in the SELECT
statement. As in the WHERE statement and the WHERE command used in
other SAS procedures, the expression in the WHERE clause can be any
valid SQL expression. In the WHERE clause, you can specify any column(s)
from the underlying table(s). The columns specified in the WHERE clause
do not have to be specified in the SELECT clause.
In the following PROC
SQL query, the WHERE clause selects rows in which the value of the
column Salary is less than 32,000. The output is also shown.
proc sql;
select empid,jobcode,salary,
salary*.06 as bonus
from sasuser.payrollmaster
where salary<32000
order by jobcode; |
Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.