LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (December 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 22 Dec 2009 08:41:58 -0800
Reply-To:     Minion <acfarrer@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Minion <acfarrer@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: bquote and unquote
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On Dec 22, 11:13 am, Tom Abernathy <tom.aberna...@gmail.com> wrote: > I still do not understand what you want. > In your example you have a PUT statement. > PUT statement does not use commas. > If you want to PUT a string col1,col2 then enclose it in quotes. > data _null_; > put 'col1,col2'; > run; > > If you have dataset variables COL1 and COL2 and you want to put the > values quoted there are many methods. > This will work, but include spaces after the value of the variables > put "'" col1 "','" col2 "'" ; > To remove the spaces you can use pointer controls. > put "'" col1 +(-1) "','" col2 "'" +(-1) ; > > You could also built up a string and then PUT the string. > str=catx(',',quote(col1),quote(col2)); > put str; > > On Dec 22, 10:47 am, Minion <acfar...@gmail.com> wrote: > > > On Dec 22, 8:45 am, "data _null_;" <datan...@gmail.com> wrote: > > > > On Dec 22, 7:06 am, Minion <acfar...@gmail.com> wrote: > > > > > After 60 mins of reviewing the archives and trying various > > > > combinations, I have to admit defeat. My only consolation is that > > > > other experienced folks have got stuck on this as well. I need to > > > > write a string ('col1,col2') with embedded commas e.g. > > > > > %let cols = %bquote(col1,col2) ; > > > > data _null_ ; > > > > put %unquote(&cols) ; > > > > run ; > > > > > This is for V8.2 on OS/390 > > > > 261 %let cols = %bquote(col1,col2) ; > > > 262 data _null_; > > > 263 put "('&cols')"; > > > 264 run; > > > > ('col1,col2') > > > > Do I understand the question? > > > Oh dear. I should have been more specific. I need the output to be: > > > col1,col2 > > > This suggestion may be a good compromise but I feel there is something > > more elegant out there. > > > sum=sum(%sysfunc(dequote(&cols))) ;- Hide quoted text - > > > - Show quoted text -

Unfortunately, the string cannot be quoted. I am reviewing the V8 Online Docs and feel that the answer is in there and tantalizingly close. Sadly, OS/390 is a lousy development environment for this stuff. This problem may be moot as I am likely to hit the old macro var length limit in some situations and need to come up with a %do loop instead. Back to the archives......


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