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 (March 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 1 Mar 2003 08:27:49 -0800
Reply-To:     "Huang, Ya" <yhuang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <yhuang@AMYLIN.COM>
Subject:      Re: Translate double quote to single quote in a macro variable ?
Comments: To: Arthur Tabachneck <atabachneck@ROGERS.COM>
Content-Type: text/plain; charset="iso-8859-1"

Thank you Art!

It dose work. I'm confused now, so when it should use quotes, when it shouldn't, what is the rules? Any explanation?

Thanks

Ya

-----Original Message----- From: Arthur Tabachneck [mailto:atabachneck@ROGERS.COM] Sent: Saturday, March 01, 2003 7:04 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Translate double quote to single quote in a macro variable ?

Ya,

Seems to work if you omit the quotes on the outer sysfunc:

%let b=%sysfunc(tranwrd(%sysfunc(translate(&a,'"',"'")),\,\\));

Art --------- Huang, Ya wrote: > Harry, > > Now I need to make b's value = Program 'L:\\xxx\\yyy\\zzz.sas', so I tried: > > 202 %let a=Program "L:\xxx\yyy\zzz.sas"; > 203 %let b=%sysfunc(tranwrd(%sysfunc(translate(&a,'"',"'")),'\','\\')); > 204 %put &b; > Program 'L:\xxx\yyy\zzz.sas' > > 205 > 206 data _null_; > 207 b=tranwrd(translate(symget('a'),"'",'"'),'\','\\'); > 208 call symput('b',b); > 209 run; > > NOTE: DATA statement used: > > 210 > 211 %put &b; > Program 'L:\\xxx\\yyy\\zzz.sas' > > As you can see, %sysfunc version dose not work, but data _null_ version is OK. > Any idea what I did wrong in the %sysfunc version? > > Thanks, > > Ya > > > -----Original Message----- > From: Droogendyk, Harry [mailto:Harry.Droogendyk@CIBC.COM] > Sent: Friday, February 28, 2003 7:20 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Translate double quote to single quote in a macro variable > ? > > > 171 %let a=Program "L:\xxx\yyy\zzz.sas"; > 172 %let b=%sysfunc(translate(&a,'"',"'")); > 173 %Put b = &b; > b = Program 'L:\xxx\yyy\zzz.sas' > > -----Original Message----- > From: Huang, Ya [mailto:yhuang@AMYLIN.COM] > Sent: February 28, 2003 7:13 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Translate double quote to single quote in a > macro variable ? > > Happy Friday! > > I have a macro variable (actually it is auto macro var > 'sysprocessname'), > which has value like this (when runs in batch mode): > > Program "L:\xxx\yyy\zzz.sas"; > > Since it already has double quote in its value, it can't be > used to assign a data step var simply use double quote like > a="&b", > neither can it be used in footnote, title etc., therefore, I > need to > translate the double quote to single quote. I have one way > to do it now, > but it need a data step as below. I wonder if there is a > more > elegant solution, hopefully a one liner. > > Thanks > > Ya Huang > > --------------- > > 28 %let a=Program "L:\xxx\yyy\zzz.sas"; > 29 > 30 data _null_; > 31 b=translate(symget('a'),"'",'"'); > 32 call symput('a',b); > 33 run; > > NOTE: DATA statement used: > > 34 > 35 %put &a; > Program 'L:\xxx\yyy\zzz.sas'


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