Date: Tue, 5 Sep 2006 12:38:39 -0500
Reply-To: Yu Zhang <zhangyu05@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yu Zhang <zhangyu05@GMAIL.COM>
Subject: Re: Check if macro parameter is empty
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
After I tried out the following code, I think the cause of the problem
should be parenthesis,( ). I am not sure what or how the %if statement is
evaluated. Apprently, when SAS macro facility saw a pair of parenthesis, it
will expect something. Could someone kindly provide more information about
%if statement evaluation? If I am totally looking at wrong target, please
let me know.
Thank you much!
/* I got same error meassge, even after I took off all the %,&'s */
%if ¯olist ne %then
%put macrolist is >¯olist<;
On 9/5/06, Ian Whitlock <firstname.lastname@example.org> wrote:
> Some more points:
> 1) You will learn faster if you explain the real problem as
> opposed to saying your solution has an error, since you
> will then find out about better solutions than the one
> you thought of and guide the helper in how to answer the
> error you are facing.
> 2) Testing
> %length(&macvar) > 0
> is safer than
> &macvar ne
> because fewer thing need to be hidden by macro quoting.
> 3) It is a very bad habit to bury macro definitions inside macros.
> Remember that the inner macro is compiled each and every time the
> outer macro is executed and nothing is accomplished by nesting
> macro definitions other than possibly preventing you from good
> design habits.
> 4) It is often better leave the %-sign of a macro invocation
> given in a parameter. In version 8.2+
> %let mac = mymac(parm=abc) ;
> works quite well and saves a lot of quoting.
> 5) The macro compile time quoting functions %STR and %NRSTR leave
> things hidden at macro execution time. Hence they should be
> used when hiding a symbol at execution time.
> 6) The execution time quoting functions, %BQUOTE, %NRBQUOTE, and %SUPERQ
> should not be used to hide a symbol; they only be used when the
> result of resolving
> will reveal a problem symbol. It is worth forgetting about %BQUOTE
> %NRBQUOTE to standardize on %SUPERQ. Anytime the prior functions are
> required the macro is too tricky to work anyway.
> Ian Whitlock
> Date: Tue, 5 Sep 2006 17:13:09 +0200
> Reply-To: yom <yomsas@GMAIL.COM>
> Sender: "SAS(r) Discussion"
> From: yom <yomsas@GMAIL.COM>
> Subject: Re: Check if macro parameter is empty
> Comments: To: toby dunn <email@example.com>
> In-Reply-To: <BAY123-F14A01BF608027DB0C086CBDE300@phx.gbl>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Thank you very much ! Tonight I will go to bed being less stupid !
> Best regards,