Date: Fri, 17 Dec 2004 09:26:50 -0500
Reply-To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject: Re: to iterate a macro
On Thu, 16 Dec 2004 23:06:35 -0500, Mayukh Dass <mayukh.dass@GMAIL.COM>
wrote:
>Hi,
>
>I have a macro %iterate. with no return value. How do I execute this
>macro 100 times?
>
>I tried something like:
>
>data one;
>do i=1 to 100;
> %iterate;
>end;
>run;
>
>but its giving an error saying that a do loop is open.
Hi, Mayukh,
Unless your %iterate macro resolves to some data step statement(s) that
can safely be looped, the above approach would not work. You can iterate
calling it using a macro loop like below, though. HTH
Cheers,
Chang
%macro iterate;
%put Hi;
%mend;
%macro hundred;
%local i;
%do i = 1 %to 5; /* change this to 100 */
%iterate
%end;
%mend;
%hundred
/* on log
Hi
Hi
Hi
Hi
Hi
*/
|