Date: Wed, 29 Sep 2004 15:23:05 -0400
Reply-To: "Fehd, Ronald J." <RJF2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <RJF2@CDC.GOV>
Subject: Re: Links and macros
Content-Type: text/plain; charset="us-ascii"
> From: Wainwright, Andrea
> We have models that are each a SAS macro.
>
> We are looking into a modeling tool that generates SAS code
> with lots of links. Since the modeling tool generates the
> links the names are very generic and maybe the same in
> another model. (A1, A2, ...)
>
> So if I have two different macros that each have a link with
> the same name, is this an issue, or does SAS stick with the
> link in the same macro? (We would never want to link from one
> macro to another) TIA
I'm going to guess that you are using the word 'link'
to mean SAS macro label.
in which case your answer is no problem.
Each macro has its own set of local labels
the only way to get from one macro to another
is to call another macro.
that said, perhaps you are saying link
and meaning data step link.
if your macros are generating data step code
which does have a link statement:
A = b;
link C;
return;
C: C = d;
return;
and two or more of those macros are used in sequence
then you may experience GotCha, two or more times.
the easier work-around is to use
&SysMacroName._A:
to replace
A:
Ron Fehd the GoTo(almost always fwd) macro maven CDC Atlanta GA USA
%Macro TestLink(action=);
%Let Action = %upcase(&Action.);
%*If %EVAL(&Action in A B C) %then <sigh> v9.1.3 knot wrx;
%If &Action eq A
or &Action eq B
or &Action eq C %then
%GoTo &Action;
%else %do;%Put invalid Action<&Action>;
%GoTo Exit;
%end;
%A: %Put do action A;%GoTo Exit;
%B: %Put do action B;%GoTo Exit;
%C: %Put do action C;%GoTo Exit;
%Put you hope knot to see this message;
%Exit:run;%Mend;
%TestLink(action=A);
%TestLink(action=B);
%TestLink(action=C);
%TestLink(action=d);