O'Reilly logo

Learning SAS by Example by Ron Cody

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

Chapter 8. Performing Iterative Processing: Looping

8.1

Introduction

117

8.2

DO Groups

118

8.3

The Sum Statement

120

8.4

The Iterative DO Loop

125

8.5

Other Forms of an Iterative DO Loop

129

8.6

DO WHILE and DO UNTIL Statements

131

8.7

A Caution When Using DO UNTIL Statements

134

8.8

LEAVE and CONTINUE Statements

135

8.9

Problems

137

Introduction

Many programming tasks require that blocks of code be run more than once. SAS provides several ways to accomplish this. This chapter covers DO groups, DO loops, DO WHILE statements, and DO UNTIL statements.

DO Groups

To demonstrate a DO group, we start with a data file containing some information on students: their age, gender, midterm grade, quiz grade, and final exam grade. A listing of this data file follows:

File c:\books\learning\grades.txt ...

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