Syntax, iterative %DO
statement with %END statement:
%DO index-variable=start %TO stop <%BY increment>;
text
%END;
index-variable
is either the name
of a macro variable or a text expression that generates a macro variable
name.
start and stop
specify either integers
or macro expressions that generate integers to control how many times
the portion of the macro between the iterative %DO and %END statements
is processed.
increment
specifies either an
integer (other than 0) or a macro expression that generates an integer
to be added to the value of the index variable in each iteration of
the loop. By default, increment is
1.
text
can be any of these
elements:
|
proc sql noprint; select teacher into :teach1- from certadv.schedule; run; %macro putloop; %local i; %do i=1 %to &sqlobs %put TEACH&i is &teach&i %end; %mend; %putloop
TEACH1 is Hallis, Dr. George TEACH2 is Wickam, Dr. Alice TEACH3 is Forest, Mr. Peter TEACH4 is Tally, Ms. Julia TEACH5 is Hallis, Dr. George TEACH6 is Berthan, Ms. Judy TEACH7 is Hallis, Dr. George TEACH8 is Wickam, Dr. Alice TEACH9 is Forest, Mr. Peter TEACH10 is Tally, Ms. Julia TEACH11 is Tally, Ms. Julia TEACH12 is Berthan, Ms. Judy TEACH13 is Hallis, Dr. George TEACH14 is Wickam, Dr. Alice TEACH15 is Forest, Mr. Peter TEACH16 is Tally, Ms. Julia TEACH17 is Hallis, Dr. George TEACH18 is Berthan, Ms. Judy
%macro rosters; %do class=1 %to 18; title "Roster for Class #&class"; proc print data=certadv.all; where Course_Number=&class run; %end; %mend; %rosters