|Date: ||Thu, 4 Mar 1999 08:07:17 +0000|
|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
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.
Author of "The Next Step: Integrating the Software Lifecycle with SAS
Director of Bioclinical Data Services Inc.