Chapter 11: Performing Conditional Processing


All programming languages enable you to perform conditional processing—making decisions based on data values or other conditions. For example, you might want to create a new variable (Age_Group) based on the values of age. Another common use of conditional logic is to check if data values are within a prescribed range.

Grouping Age Using Conditional Processing

For the first example, you have data on gender, age, height, and weight. You want to create a new variable (Age_Group) based on the variable Age. Here is a first attempt that runs but has a logical flaw in regard to SAS missing values.

Program 11.1: First Attempt at Creating an Age Group Variable (Incorrect Program)

data People; ...

Get Getting Started with SAS Programming now with O’Reilly online learning.

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