@jason4sas wrote:
Agree. But still, how come the returned value is truncated? If I simply replace the macro variable with its true value, the truncation is not happening:
%put WARNING: %sysfunc(ifc(%length(abv,bdev),%str(,abv,bdev),));
WARNING: ,abv,bdev
Therefore, it seems %str(,&final_class) coming with something unexpected inside of the %sysfunc.
Because now there is something for %STR() to quote. Before %STR() was ignoring the value of the macro variable. That is not its job to worry about.
If you look at the values that are stored in the SASHELP.VMACRO you can see how there is difference between the result of use %str() on A,B when it is text or when it is the result of expanding a macro variable reference.
10 %let x=A,B;
11 %let y=%str(A,B);
12 %let z=%str(&x);
13
14 data _null_;
15 set sashelp.vmacro;
16 where name in ('X','Y','Z');
17 put name= value= +1 value $hex12.;
18 run;
name=X value=A,B 412C42202020
name=Y value=AB 01411E420220
name=Z value=A,B 01412C420220
And if you use %QUOTE(&x) instead you get:
name=Z value=AB 03411E420820
... View more