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 (September 2010, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 30 Sep 2010 20:13:26 -0400
Reply-To:   Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject:   Re: Quoting functions and trim

Using %Qscan seems to eliminate the error messages. What are you trying to do with the TRIM? Remove the leading spaces?

NOTE: Remote submit to SAS9 commencing. 2 %macro test(string=); 3 4 5 %put string = &string; 6 7 8 %let n = %sysfunc(countw(&string,|)); 9 %put n = &n; 10 11 12 %do i = 1 %to &n; 13 %put i = &i (no trim) -> "%qscan(&string,&i,|)"; 14 %put i = &i (with trim) -> "%trim(%qscan(&string,&i,|))"; 15 %end; 16 17 18 %mend test; 19 20 21 %test(string=A string| B string); string = A string| B string n = 2 i = 1 (no trim) -> "A string" i = 1 (with trim) -> "A string" i = 2 (no trim) -> " B string" i = 2 (with trim) -> " B string" 22 %test(string=A string| B string%str(%')s); string = A string| B string's n = 2 i = 1 (no trim) -> "A string" i = 1 (with trim) -> "A string" i = 2 (no trim) -> " B string's" i = 2 (with trim) -> " B string's" NOTE: Remote submit to SAS9 complete.


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