Date: Tue, 5 Feb 2008 01:55:53 +0000
Reply-To: iw1junk@COMCAST.NET
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <iw1junk@COMCAST.NET>
Subject: Re: checking for missing parameters
Toby,
Since you have made the user responsible for all parameter mistakes, why
should you ever bother to check a parameter?
If you need to check whether X is a single blank then use
%length(&x) = 0 and %length(%superq(x)) = 1
On the other hand, 99 times out 100 I want a value and blank is not good
enough. Just how many macros do you write where it is important to distinguish
a blank from a null? Perhaps you can give a significant and simple example to
show that this discussion is not simply childish.
Ian Whitlock
-------------- Original message ----------------------
From: toby dunn <tobydunn@hotmail.com>
>
> Ian ,
>
> Who is responsible for the parameters values, the macro writer or the macro
> user?
>
> I prefer to make the Macro User responsible for the values they give the macro
> to use.
>
>
> If as you say checking by using %Length( &X ) = 0 is superior then it will fail
> when a %Str( ) is a valid value for the parameter. Okay so you could say in
> this case use %Length( %SuperQ(x) ) = 0. Now you require the macro writer to
> think more than is necessary for the task.
>
> The mear fact that the only way to get a Blank into a parameters value is
> through macro quoting or bad programming, means to me that it is the macro user
> is responsible to not use Blanks if they dont want the macro to use them.
>
>
> > So you write like SAS, what is your default activity when the name is null?
> The macro should write out a reasonable message so the macro user understands
> what went wrong and what to do to fix the problem. Finally have the macro end
> without running anymore code.
>
>
> >What is you default activity when the name is just blanks?
> Let the macro run.
>
>
>
> Toby Dunn
>
> "Don't bail. The best gold is at the bottom of barrels of crap."
> Randy Pausch
>
> "Be prepared. Luck is where preparation meets opportunity."
> Randy Pausch
>
>
> > Date: Sat, 2 Feb 2008 02:11:03 +0000
> > From: iw1junk@COMCAST.NET
> > Subject: Re: checking for missing parameters
> > To: SAS-L@LISTSERV.UGA.EDU
> >
> > Toby,
> >
> > It may be your imagination or your consumers.
> >
> > Which is more likely in a parameter giving an optional variable name when it
> is
> > all blanks?
> >
> > 1) The user didn't want to specify a name
> > 2) You want to assign a value to what was given
> >
> > Or to put it another way, SAS is a language of defaults and avoids a lot of
> > mother-may-I or else type of stuff. So you write like SAS, what is your
> > default activity when the name is null? What is you default activity when
> > the name is just blanks?
> >
> > Ian Whitlock
> >
> > -------------- Original message ----------------------
> > From: toby dunn
> >>
> >> Ian ,
> >>
> >> I am having a hard time believing that you would ever want to consider a
> Blank
> >> the same as a Nothing value in the macro facility. Toby Dunn "Don't bail. The
> >> best gold is at the bottom of barrels of crap." Randy Pausch "Be prepared.
> Luck
> >> is where preparation meets opportunity." Randy Pausch>
> >
> >
>
> _________________________________________________________________
> Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008
|