|
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.
|