s*******f 发帖数: 148 | 1 i'm trying to scan &syspbuff in order to assign the value to a macro
variable call &cc.
Usually i do it like this:
%macro m1 / parmbuff;
...
%let cc=%scan(&syspbuff,2);
...
%mend m1;
%m1(a,b,c,d,e)
Here &cc will be resolved to b.
But what if i would like to scan some strings with single quotes and commas?
such as:
%m1(%str('a','b','c')*%str('d','e'))
Here * is the delimiter (and i dunno if i treat it right with %str). I wanna
get the 'd','e' part as a whole from the scanning above.
I | l*********s 发帖数: 5409 | 2 why not pass the whole param list as a whole and qscan it in your macro? | s*******f 发帖数: 148 | 3 Thanks for the reply! There's some strange problem when i use %qscan here:(
It does work great if i assign the string to a macro var with %let statement:
log:
3688 %let a=%str('a','b'*'c','d');
3689 %put temp1=%qscan(&a,1,*);
temp1='a','b'
3690 %put temp2=%qscan(&a,2,*);
temp2='c','d'
which is exactly what i want. However, for some reason, the scanned value
will include the single parenthesis in my macro program...
code:
%macro m1 / parmbuff;
...
%let cc=%qscan(&syspbuff,&i,*);
%p
【在 l*********s 的大作中提到】 : why not pass the whole param list as a whole and qscan it in your macro?
| l***a 发帖数: 12410 | 4 not familiar with %qscan. do you want to try this?
%let cc=%qscan(&syspbuff,&i+1,*());
statement:
【在 s*******f 的大作中提到】 : Thanks for the reply! There's some strange problem when i use %qscan here:( : It does work great if i assign the string to a macro var with %let statement: : log: : 3688 %let a=%str('a','b'*'c','d'); : 3689 %put temp1=%qscan(&a,1,*); : temp1='a','b' : 3690 %put temp2=%qscan(&a,2,*); : temp2='c','d' : which is exactly what i want. However, for some reason, the scanned value : will include the single parenthesis in my macro program...
| s*******f 发帖数: 148 | 5 yeah it works!
Thanks a lot!!!!:D
【在 l***a 的大作中提到】 : not familiar with %qscan. do you want to try this? : %let cc=%qscan(&syspbuff,&i+1,*()); : : statement:
|
|