Date: Mon, 26 Apr 2004 14:10:02 -0400
Reply-To: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject: Re: symchk: checking for macro variable existance
Content-Type: multipart/mixed;
Quentin writes
> I would agree that revising to upcase(name) sounds like good
> defensive coding. Would just add that there is a cost to
> upcasing strings unnecessarily (which I have at times been
> willing to pay). I believe when you use the upcase()
> function on the where statement, sas cannot use any available
> index. So I've seen things slow down a *lot* when using a
> where statement against a big dictionary table, and adding
> upcase() in order to be defensive. So there is a cost to
> weigh against the benefit. In many cases, it's may be worth
> the cost for the defensive gain (wasn't too long ago that all
> variable names were upcase, and I'd imagine some macros
> started breaking when they went to mix case in v7).
point well taken: yes,
I am aware of the cost of adding functions to a where clause.
in this case, we're already behind the 8-ball
because we're reading a view: SAShelp.vMacro.
in the long run,
I can's see that this function will be used a great deal
it is a pretty esoteric tool,
that said I am/will be using it in a lot of fan-in macros
i.e. sub-routines called often by many other routines/macros.
so perhaps I shall just put that upcase(name) in the change notes
for the far-off future when the names are Upper- and Lowercased
and it breaks.
> >The macro had
> >%let DsId = %sysfunc(open(SAShelp.vMacro
> >(where = (name = "%UPCASE(&Name)"))));
> >
> >and the question was
> >-- with regard to defensive programming --
> >whether this was more robust:
> >(where = (upcase(name) = "%UPCASE(&Name)"))));
> >
> >TechSupport replied:
> >
> >> I cannot guarantee the future,
> >> but at this point in time,
> >> yes they are stored in upper case.
> >> I do not know of any plans to change that.
> >
> >I'm planning to make that change:
> >no fear for that macro breaking
> >and a I'll always have a good night's sleep when I remember it.
> >
> >Ron Fehd the robust macro maven CDC Atlanta GA USA RJF2@cdc.gov
> >
> >Efficiency is intelligent laziness. -David Dunham
> >... and defensive coding for robustness
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.
Visit us at http://www.cognizant.com
|