Date: Tue, 30 Aug 2005 09:39:35 -0700
Reply-To: "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM>
Subject: Re: Best practice: check for blank macro parameters
Content-Type: text/plain; charset="US-ASCII"
Hi Matt,
Very well written question. Without answering
directly but possibly indirectly, the first
thing that comes to mind is the interesting
aspect that may/maynot come out of this, which
I am wondering how many people first use your
first syntax, and then as subtle data content
inaccuracies creep into the picture that people
apply the varying degrees of necessity in the
exact same order that you have listed them.
It seems that it may not be that we incur greater
"degrees" of undesired result but probably more
that we incur certain levels of need on a less
frequent basis. e.g.
92% &VAR= %then
5% "&VAR"=""
2% &VAR=%str()
1% %superq(),%nrstr,%bquote,%nrbquote
It's not that these percentages are accurate,
because enviroments will differ, but it was just
a curiosity of mine in seeing the "pattern of
use" (or the driven need) since it is not so much
a question of which is right or wrong, or better
or worse, because we can already assume just
as any other language command or function that
each is black and white and already has its
set of characteristics and behaviors dependent
upon the data content being processed.
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investment Group
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of m n
Sent: Tuesday, August 30, 2005 9:00 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Best practice: check for blank macro parameters
Dear SAS-L,
For the common practice of checking that required
macro parameters are not blank, different programmers
adopt different approaches:
* %if &VAR= %then <insert code>
* %if "&VAR"="" %then <insert code>
* %if &VAR=%str() %then <insert code>
* using %superq(), %nrstr, %bquote, %nrbquote, etc in
various ways.
Etc, etc.
Is there any consensus among the gurus as to a Best
Practice in this regard (i.e. a method that is quite
likely to work regardless of what users may pass into
the macro)?
Thanks in advance,
Matt
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
|