| Statements with the Same Function in Multiple Procedures |
| WHERE where-expression; |
| Required Arguments |
is a valid arithmetic or logical expression that generally consists of a sequence of operands and operators. See the SAS Language Reference: Dictionary for more information on where processing.
| Procedures That Support the WHERE Statement |
You can use the WHERE statement with any of the following Base SAS procedures that read a SAS data set:
| CALENDAR | RANK |
| CHART | REPORT |
| COMPARE | SORT |
| CORR | SQL |
| DATASETS (APPEND statement) | STANDARD |
| FREQ | TABULATE |
| MEANS/SUMMARY | TIMEPLOT |
| PLOT | TRANSPOSE |
| UNIVARIATE |
| Details |
The CALENDAR and COMPARE procedures and the APPEND statement in PROC DATASETS accept more than one input data set. See the documentation for the specific procedure for more information.
To subset the output data set, use the WHERE= data set option:
proc report data=debate nowd out=onlyfr(where=(year='1')); run;
For more information on WHERE=, see the SAS Language Reference: Dictionary.
| Example |
In this example, PROC PRINT prints only those observations that meet the condition of the WHERE expression. The DEBATE data set is created in Example: Temporarily Dissociating a Format from a Variable.
options nodate pageno=1 linesize=64 pagesize=40;
proc print data=debate noobs; where gpa>3.5; title 'Team Members with a GPA'; title2 'Greater than 3.5'; run;
Team Members with a GPA 1
Greater than 3.5
Name Gender Year GPA
Capiccio m Freshman 3.598
Tucker m Freshman 3.901
Bagwell f Sophomore 3.722
Gold f Junior 3.609
Syme f Junior 3.883
Baglione f Senior 4.000
Carr m Senior 3.750
Hall m Senior 3.574
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.