Previous Page | Next Page

Macro Statements

%END Statement

Ends a %DO group.
Type: Macro statement
Restriction: Allowed in macro definitions only

Ending a %DO group




Example 1: Ending a %DO group

This macro definition contains a %DO %WHILE loop that ends, as required, with a %END statement:

%macro test(finish);
   %let i=1;
   %do %while (&i<&finish);
      %put the value of i is &i;
      %let i=%eval(&i+1);
%mend test;


Invoking the TEST macro with 5 as the value of finish writes these lines to the SAS log:

The value of i is 1
The value of i is 2
The value of i is 3
The value of i is 4

Previous Page | Next Page | Top of Page