LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 9 Jun 2008 10:48:22 -0400
Reply-To:     Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:      Re: Calling to a macro with positional parameters' values in a
              SAS data set

simply write another macro and call the first in a loop:

data _null_; set the_parameter_data; call symput("n",_n_); call symput("p_one"!!put(_n_,8. -l),p1); call symput("p_two"!!put(_n_,8. -l),p2); call symput("p_three"!!put(_n_,8. -l),p3); run;

%macro doit; %do i=1 %to &n; %m(&&p_one&i, &&p_two&i, &&p_three&i); %end; %mend; %doit;

be careful with &i, &n, ... They are global to %m! If you use them in %m also, there is trouble! Gerhard

On Mon, 9 Jun 2008 07:33:02 -0700, Jianling Wang <highouse@GMAIL.COM> wrote:

>Hi All, > > I need to run a macro with three positional parameters like this: > >%macro M (positional-1, positional-2, positional-3); >macro codes here >%mend M; > > My problem is that I need to run this macro 200 times, while the >values of the positional parameters were stored in a data set of three >variables and 200 observations. Is there a way to tell SAS to look >for the values in the data set instead of me manually write 200 lines >of code calling to the macro M (the only way I know now to accomplish >the task)? > > I appreciate your time and attention to this!! > >Jianling


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