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 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 25 May 2001 23:47:06 +0100
Reply-To:     Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Organization: Crawford Software Consultancy Limited
Subject:      Re: TRANSLATE and TRANWRD behave differently in %sysfunc?

Inside %sysfunc() you are operating in the macro environment, where the tranwrd is operating on the quote(') symbol as well as the 23/5. This is a log of your process without those quotes %let testval=test5_5; 2 data _null_; 3 var="&testval."; 4 var1=translate(var,'23','_5'); 5 sysfunc1=%sysfunc(translate("&testval.",23,_5)); 6 var2=tranwrd(var,'_5','23'); 7 sysfunc2=%sysfunc(tranwrd("&testval.",_5,23)); 8 put var1 sysfunc1; 9 put var2 sysfunc2; 10 run;

test323 test323 test523 test523 NOTE: DATA statement used: real time 1.42 seconds

David Parent <dparent@UCLA.EDU> writes >Hello all, > > The code below was run on Windows 98 in SAS 8.0 and SAS 6.12. The >TRANSLATE function returns the same results with %sysfunc. However, the >TRANWRD function is providing different results. Can anyone kindly point >out what I am missing? > >Thanks, >David Parent > >%let testval=test5_5; >data _null_; > var="&testval."; > var1=translate(var,'23','_5'); > sysfunc1=%sysfunc(translate("&testval.",'23','_5')); > var2=tranwrd(var,'_5','23'); > sysfunc2=%sysfunc(tranwrd("&testval.",'_5','23')); > put var1 sysfunc1; > put var2 sysfunc2; >run; > >~~LOG~~ > >1 >2 %let testval=test5_5; >3 data _null_; >4 var="&testval."; >5 var1=translate(var,'23','_5'); >6 sysfunc1=%sysfunc(translate("&testval.",'23','_5')); >7 var2=tranwrd(var,'_5','23'); >8 sysfunc2=%sysfunc(tranwrd("&testval.",'_5','23')); >9 put var1 sysfunc1; >10 put var2 sysfunc2; >11 run; > >test323 test323 >test523 test5_5 >NOTE: DATA statement used: > real time 0.50 seconds

-- Peter Crawford


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