Date: Thu, 8 Mar 2001 10:47:25 -0500
Reply-To: sander.post@STATCAN.CA
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: sander.post@STATCAN.CA
Subject: Macro resolution in 8.1 vs. 6.12
Content-Type: text/plain; charset="iso-8859-1"
The following is a much simplified version of code that I've inherited. It
works fine and as expected under 6.12.
Under SAS 8.1 however, it crashes.
It seems a macro call with a macro variable in it resolves in the wrong
order. With the macro variable r having a value of i, the call
%err&r(104);
calls the macro %err and generates a number of errors, including array I is
not defined.
Under 6.12 it calls %erri with the parameter 104, which is the desired
effect.
For now, we are continuing to run this under 6.12, but as that won't always
be an option, does anyone have any ideas short of rewriting the program
(there are a number of programs with the same general setup) to solve this?
Perhaps a macro option - I couldn't find any reference to this under the
version 8 macro documentation under changes and enhancements.
---
%macro err(message);
message=&message.;
put "macro err" message=;
%mend err;
%macro erri(message);
message=&message.;
put "macro erri" message=;
%mend erri;
%macro keyflds(var1,r);
data x;
%if &var1=INC %then %do;
%err&r.(104.00);
%end;
run;
%mend keyflds;
%keyflds(INC,i);
Thanks,
Sander.