LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: Mayukh Dass <mayukh.dass@GMAIL.COM>

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 */


Back to: Top of message | Previous page | Main SAS-L page