Selecting Observations

Understanding the Selection Process

The most common way that SAS selects observations for action in a DATA step is through the IF-THEN statement:
IF condition THEN action;
The condition is one or more comparisons, for example:
  • City = 'Rome'
  • NumberOfEvents > Nights
  • TourGuide = 'Lucas' and Nights > 7
The symbol > means greater than. How to use symbols as comparison operators is explained in Understanding Construct Conditions.
For a given observation, a comparison is either true or false. In the first example, the value of City is either Rome or it is not. In the second example, the value of NumberOfEvents in the current observation is either greater than the value of Nights in the same observation or it ...

Get Step-by-Step Programming with Base SAS 9.4 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.