Previous PageNext Page

Do Group
Execute a group of statements if a condition is true:

If gender="F" Then
Do;

End;

You may also repeat the group of statements based on a condition. To check the condition before you execute the group, use DO WHILE(condition). The group will be repeatedly executed as long as the condition is true.

n=0;
do while(n<5);
put n=;
n+1;
end;

In some cases, you will want to decide to repeat a group after the group has executed. That is, you check on a condition after execution to see if you wish to continue. Use DO UNTIL(condition ) to accomplish this. At least one execution of the DO group will take place, since the condition is check afterwards.

n=0;
do until(n>=5);
put n=;
n+1;
end;

Previous PageTable Of ContentsNext Page