Chapter 11: Performing Conditional Processing

Introduction

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