Previous Page | Next Page

Statements with the Same Function in Multiple Procedures

WHERE


Subsets the input data set by specifying certain conditions that each observation must meet before it is available for processing.
WHERE where-expression;

Required Arguments

where-expression

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
PRINT UNIVARIATE


Details


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

Previous Page | Next Page | Top of Page