Example 8.1 Performing a Simple Subset


Create a subset of a SAS data set efficiently by selecting for processing only observations that meet a particular condition.

Example Features

Featured StepDATA step
Featured Step Options and StatementsWHERE statement
Related TechniquePROC SQL, WHERE clause
A Closer LookComparing the WHERE Statement in the DATA Step and the Subsetting IF Statement

Input Data Set

Data set CELLPHONES contains the support records for one day. Only the first 25 of 10,000 observations are shown.


  Obs   callhour   calllength     status       reason 1 00 10 Resolved Text Msg Help 2 00 2 Transferred Other Feature Help 3 01 3 Resolved Start Service 4 01 2 Resolved Other 5 01 4 Resolved Voice Mail Help 6 01 4 Resolved Billing Change ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.