O'Reilly logo

Step-by-Step Programming with Base SAS 9.4 by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required