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 (May 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 May 2008 21:31:32 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: Need to have % chars in a macro var--can I get rid of this
Comments: To: Yu Zhang <zhangyu05@gmail.com>
In-Reply-To:  <445d9dbe0805151420w657abdb5k109f455a3bfc9596@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Upon thinking about this some more the better route to go is :

proc sql noprint feedback ; select Quote(result_code) into :vdw_tests separated by ' , ' from result_codes ; reset print ; select * from result_codes where result_code in (&vdw_tests) ; quit ;

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: Thu, 15 May 2008 16:20:57 -0500 From: zhangyu05@gmail.com To: tobydunn@hotmail.com Subject: Re: Need to have % chars in a macro var--can I get rid of this CC: SAS-L@listserv.uga.edu

it needs an "unquote" here,

where

result_code in ("%unquote(%superq(vdw_tests))");

Yu

On Thu, May 15, 2008 at 3:42 PM, toby dunn <tobydunn@hotmail.com> wrote:

where result_code in ("%SuperQ(vdw_tests)")

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: Thu, 15 May 2008 13:12:52 -0700 > From: pardee.r@GHC.ORG

> Subject: Re: Need to have % chars in a macro var--can I get rid of this > To: SAS-L@LISTSERV.UGA.EDU > > That hasn't worked in the places I've tried it. What do you have in > mind? > > Thanks! > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > karma > Sent: Thursday, May 15, 2008 12:14 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Need to have % chars in a macro var--can I get rid of this > > On May 15, 7:34 pm, parde...@GHC.ORG ("Pardee, Roy") wrote: >> Hey All, >> >> The code below gives the harmless WARNING "Apparent invocation of >> macro <> not resolved.". I think I'm resolved to ignore it,

> >> but wondered if there was a straightforward way of getting rid of it. > >> Any takers? >> >> My goal is to put a list of quote-delimited values for an IN() list >> into a macro variable so I can thereafter use it in a passthrough >> query (not shown ;-). This was working quite duckily until I added >> result_code values with the dreaded percent signs. >> >> Thanks! >> >> -Roy >> >> * ------------------ code ---------------------- ; >> >> data result_codes ; >> input >> @1 result_code $char9. >> @12 vdw_name $char10. >> ; >> datalines ; >> PSA*H PSA >> %FPSA*H PFPSA >> QCPSA*H PSA >> ; >> >> proc sql noprint feedback ; >> >> select result_code into :vdw_tests separated by '", "' >> from result_codes >> ; >> >> * None of the quoting functions I tried got rid of the error. ; >> %*let tsts = %nrbquote(&vdw_tests) ; >> >> reset print ; >> >> * In real life I am using the in-list in a pass-through query--this >> is just a sanity-check. ; >> select * >> from result_codes >> where result_code in ("&vdw_tests") >> ; >> >> quit ; >> >> Roy Pardee >> Research Analyst/Programmer >> Group Health Center For Health Studies (Cancer Research Network) >> (206) 287-2078 >> Google Talk: rpardee > > Hey Roy, > > Use %nrstr(); > > HTH

_________________________________________________________________ Make Windows Vista more reliable and secure with Windows Vista Service Pack 1. http://www.windowsvista.com/SP1?WT.mc_id=hotmailvistasp1banner

_________________________________________________________________ Make Windows Vista more reliable and secure with Windows Vista Service Pack 1. http://www.windowsvista.com/SP1?WT.mc_id=hotmailvistasp1banner


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