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 (March 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 28 Mar 2006 05:08:38 -0500
Reply-To:     Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:      Re: Problem with scope of macro variables

without following the thread: unfortunately there are no real good ways of returning values from macros. There are no referential parameters to return any results from a macro call, so I think there is no really easy way to avoid global variables.

If you have a macro like:

%let a=outside; %macro test(a); %put inside: &a; %let a=inside; %mend; %test(&a); %put the result is: &a;

you see that the passed argument &a is not changed. There is only a passing of values into the macro, but not out. At some places it is possible to work with a kind of function-call, like:

%let a=outside; %macro test(b); %put &b; %let b=inside; &b; %mend; %let a=%test(&a);

%put the result is: &a;

On Tue, 28 Mar 2006 02:34:21 -0500, SUBSCRIBE SAS-L Katja Gla=?ISO-8859-1?Q?=DF?= <cayburn@GMX.DE> wrote:

>I see the point. I whish I could redesign the system without global macro >variables. Unfortunately the system is really complex, and consists of >quite a lot of macros. Even the environment is not that simple, so "work" >can't be used for this, and it must support multiple users and some more >things to consider ;) . >At least this problem appeard the first time in 5 years of use. I will >just update the global macro variable if this variable really has been >changed, so this will also reduce the appearancy. To get the error in the >log is a good indicator, that the user of the system has to change the >name of a global macro variable. >Now I know, then when I create a system from the scratch, I won't work >with setting and resetting of global macro variables. >Hopefully in some later SAS versions more weird things are solved. >Thanks for the discusstion. >From my side everything is fine as well. > >Regards, >Katja :-)


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