由买买提看人间百态

topics

全部话题 - 话题: syspbuff
(共0页)
s*******f
发帖数: 148
1
来自主题: Statistics版 - A quick question about masking in macro
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
s*******f
发帖数: 148
2
来自主题: Statistics版 - A quick question about masking in macro
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***a
发帖数: 12410
3
来自主题: Statistics版 - A quick question about masking in macro
not familiar with %qscan. do you want to try this?
%let cc=%qscan(&syspbuff,&i+1,*());

statement:
(共0页)