Account Options

  1. Sign in
Google Groups Home
« Groups Home
Message from discussion Macro variable resolves to - question
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
"data _null_,"  
View profile  
 More options Apr 7 2008, 1:54 pm
Newsgroups: comp.soft-sys.sas
From: datan...@GMAIL.COM ("data _null_,")
Date: Mon, 7 Apr 2008 12:54:30 -0500
Local: Mon, Apr 7 2008 1:54 pm
Subject: Re: Macro variable resolves to - question
You have mentioned when BQUOTE works but superQ does not but not
example  and Chang has provided example where BQUOTE does not produce
the desired result.  Can "we"  SAS-L make some kind of example or
table that summarize all this.

The topic has my head spinnin'.

On Mon, Apr 7, 2008 at 12:25 PM, toby dunn <tobyd...@hotmail.com> wrote:
> Gerhard ,

> To understand what Data _Null_  is talking about you have to go back and follow the link from the Elvis dudes web page.  There you will find the the offending code and it will make Data _Null_'s post make sense.

> Since Data _Null_ invoked my name Ill comment on this.  %SuperQ in my view is far superior to %BQuote or the double quote method.   I have only seen one example were %BQuote was even neccessary and it made sense to use it over %SuperQ.  The double quote method has more problems with it than you can shake a stick at and should be avoided its an old hack solution when working with Macro comparisions and does nothing but add to the list of possible errors, add more typing, and more confusion over all.  If one wants to decide whether a variable is empty then the judicious use of %Length would be a better option than all this crazy looking crap I have seen with no right hand side values in a implicit or explicit %eval statements.  Clarity as to the intent and funtionality of the code should be one of most important goals in programing.

> In short if you think or find yourself needing more than: %Str, %NRSTR, %SuperQ, %BQuote (only once in a great blue moon), or %Unquote then perhaps one should stop and ask whether they needto be writing a macro at all and if their approach to the problem is teh correct one.

> 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: Mon, 7 Apr 2008 12:58:50 -0400
> > From: gerhard.hellrie...@T-ONLINE.DE
> > Subject: Re: Macro variable resolves to - question
> > To: SA...@LISTSERV.UGA.EDU

> > Hi datanull,
> > did I understand something wrong?
> > As far as I see, the environment is "open code", not macro. Something like:

> > %let a=Alice;

> > data a;
> > set sashelp.class;
> > if "&a" = name ;
> > run;

> > ???? don't know what I could here with macro-functions.

> > and that I don't understand:

> > If &risk="" THEN test=1;
> >>>> Else If &risk="ab" RHEN test=2;

> >>>> %macrotest()
> >>>> %macrotest(ab)

> > where is %macrotest? Should the>>If &risk="" THEN test=1<< be macro-code?
> > And what the hell does

> > Else If &risk="ab" RHEN test=2;

> > mean?

> > Ok, maybe ... THEN test=2;

> > But how does the whole code look like? Is the above (and below) a part of
> > a DATA-step? Or is it something like "pseudo-macro-code" and should really
> > be

> > %if .... %then .... %do; ???

> > Gerhard

> > On Mon, 7 Apr 2008 10:47:39 -0500, data _null_,  wrote:

> >>I looked a the tip you referenced and your 5 other tips. I do not
> >>agree with using double quoted strings in macro expressions, as you
> >>suggest. While like you point out it is "simple" and will provide
> >>correct code "most" of the time. I believe that proper macro quoting
> >>functions should be used instead. And yes I have used double quoted
> >>strings in macro expressions in the past.

> >>%bQuote should provide the necessary quoting in most cases. I have
> >>noticed that Toby and has a new fondness for %superQ. Which, if I
> >>understand correctly will provide complete "protection" from any and
> >>all unknown pathogens in all circumstances.

> >>For example,

> >>%if %bquote(&arg) eq %then %do.....

> >>On Mon, Apr 7, 2008 at 6:08 AM,  wrote:
> >>> Hi Stefan,

> >>> Your question has been answered already, but you might also like to
> >>> read my SAS Tip page on this subject for a more complete explanation:

> >>> http://www.oview.co.uk/sastips/st2_macro_quoting.htm

> >>> Regards,

> >>> Chris.
> >>> --------------------------------------------------------
> >>> Elvis SAS Log Analyser - http://www.oview.co.uk/elvis
> >>> Version 1.4 now available - try the new Date Calculator!
> >>> --------------------------------------------------------

> >>> On 5 Apr, 14:34, stefan.p...@ISH.DE (Stefan Pohl) wrote:
> >>>> Dear sas-list,

> >>>> I have a macro variable risk which can be empty or ab.

> >>>> If &risk="" THEN test=1;
> >>>> Else If &risk="ab" RHEN test=2;

> >>>> %macrotest()
> >>>> %macrotest(ab)

> >>>> risk does not resolve in the coorect way if risk is empty.

> >>>> Do I have to assign risk always a character string which cannot be
> > empty?

> >>>> Stefan.

> _________________________________________________________________
> Pack up or back up–use SkyDrive to transfer files or keep extra copies. Learn how.
> hthttp://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_R...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.