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 (February 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 10 Feb 2005 14:15:41 -0500
Reply-To:     "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject:      Re: Howto Parse Macro Variable Into Variables Delimited By Speech
              Marks

ben.powell@CLA.CO.UK wrote: > Dear SAS-L > > I have an extract macro that takes a text variable that can either by > missing (not entered) and hence equal to ""; a single two character > string e.g. XX; or multiple two character strings e.g. XX YY ZZ. > > I want to pass that macro variable to an sql query where clause. I've > incorporated error handling so the query only fires if the string ^ = > "" but inorder to search on each of the two char strings they must be > delimited by speechmarks. >

If I understand, this would work.

Assuming callee honors the contract for text.

%let text = XX YY ZZ AA; %let inclause = "%sysfunc (TRANWRD(&text,%str( )," "))"; %put &text; %put &inclause;

XX YY ZZ AA "XX" "YY" "ZZ" "AA"

for safety you might want to COMPBL before TRANWRD.

-- Richard A. DeVenezia http://www.devenezia.com/


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