Creating Multiple Observations from a Single Record |
Reading the Same Number of Repeating Fields
![]() |
Executing SAS Statements Based on a Variable
Value
Each record contains four different values for |
In the following example, the index-variable
count is assigned an initial value of 1. The expression
count =1 is evaluated before the statements in the loop
are executed. The END statement closes the loop and passes control back to
the DO statement, where the value of count is then set to
16. The expression count =16 is evaluated and
the loop executes once more. Now there are no more values for
count , so the loop stops. |
do count=1,16; |
If the specification is a range of values, the loop executes
from the initial value to the ending value. For example, the following statement
executes the loop when the value of count is 1,
2, 3, and 4. The count is incremented at the bottom
of the loop. When the value of count exceeds 4, the
loop does not execute. |
do count=1 to 4; |
The default increment is one; however, you can specify another
increment. Here the value of count is incremented by two, so
the loop executes only when the value of count is 2,
4, 6, and 8. |
do count=2 to 8 by 2; |
![]() ![]() ![]() ![]() ![]() ![]() |
|
![]() |
![]() |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.