Date: Thu, 5 Jun 2008 12:08:48 -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: Macro var resolution with %EVAL
...if you like the
%do i=1 %to 13... more, you should think about:
%let x=%eval(13-&i);
... WALMART.CLAIMSSR.M&&MT&x.,DISP=...
Gerhard
On Thu, 5 Jun 2008 08:42:41 -0700, Daniel <daniel.biostatistics@GMAIL.COM>
wrote:
>Good morning All,
>
>I have defined a number of macro variables in my code that have
>sequentially numbered names: MT1, MT2, MT3, ..., MT12.
>
>At some point, I need to refer to these macro variables to write JCL
>code, using a PUT statement and a %DO loop. Here is the portion of the
>code that is of interest:
>
>%MACRO MAKEJCL;
>DATA _NULL_;
> FILE "FILE_LOCATION";
> PUT
>@1 "//MAKEJCL JOB ... JCL JOB DEFINITION PARAMETERS GO HERE ..."/
>...
>more lines of code
>...
>%DO I=1 %TO 12;
>@1 "// DD DSN=CST.IMCPRX40.WALMART.CLAIMSSR.M&&MT%EVAL(13-
>&I).,DISP=SHR"/
>%END;
>...
>more lines of code
>...
>%MEND MAKEJCL;
>
>%MAKEJCL;
>
>This piece of code runs and produces the desired output. However, I
>get the following message in the log:
>
>WARNING: Apparent symbolic reference MT not resolved.
>
>Perhaps there is something I am missing in my code above that, when
>present, would not produce the warning message. More specifically,
>something to tell SAS to wait until it reaches the end of "%EVAL(13-
>&I)" to actually resolve the macro variable. Right now, it seems to
>try to resolve &MT first, does not find anything, produces the warning
>message, then continues with the %EVAL portion, concatenates this with
>the &MT, and resolves to the appropriate value.
>
>Any suggestion will be greatly appreciated. Thank you,
>
>Daniel
|