LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 1999, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 4 Mar 1999 08:07:17 +0000
Reply-To:   paulgill@jps.net
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Paul Gill <paulgill@JPS.NET>
Subject:   Re: MACRO invocation
Content-Type:   text/plain; charset=us-ascii

At 18:01 03/03/99 +0000, Peter Crawford wrote:

>Should we make it a standard that the first statement in a macro is >%local

and John Whittington responded:

>... or, had some clever person thought of it in the first place (too late to >change now, I guess, becasue of compatability problems), to make that the >default, with Global having to be 'user-requested' by a statement!

As many are aware, the rule for the creation of macro variables is: the macro processor searches the current referencing environment and all other referencing environments of that name. It changes the value of that variable rather than create a new one.

I find this rule to be completely counterintuitive and a very bad feature of the language.

So, yes.. I strongly believe that one should get in the habit of declaring local macro variables explicitly with a %local statement. Many people use &i, &j, &cnt, &count, &num etc., and without the %local declaration, the chances of clashing with macro variables in other environments are very high. Going a step further, I believe this convention should part of a shop's programming standards.

Paul Gill Author of "The Next Step: Integrating the Software Lifecycle with SAS Programming" Director of Bioclinical Data Services Inc. (925) 831-9169 paulgill@jps.net


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