LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
In-Reply-To:  <090520061642.17513.44FDA8D9000744F200004469220700095305029A06CE9907@comcast.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Dear Members,

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!

Yu

/* I got same error meassge, even after I took off all the %,&'s */ %let macrolist=hello(); %macro MyMacro; %if &macrolist ne %then %do; %put macrolist is >&macrolist<; %end; %mend; %MyMacro;

On 9/5/06, Ian Whitlock <iw1junk@comcast.net> wrote: > > Yom, > > 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) ; > %&mac > > 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 > and > %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 <tobydunn@hotmail.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, > yom > <snip> >


Back to: Top of message | Previous page | Main SAS-L page