You are right ! The result from the %length macro function in my
post should be 4 instead of 3.
I didn't track the discussion about macro quoting. I think Ian
has given an excellent summary about when or how to use macro quoting
functions. It is a very good guideance for most of SAS programers who
are writing or using SAS macros.
The reason that I say %length is a very special macro function
with any number of commas is that few people know that %length is a
special vararg macro that can take any number of macro parameters,
including commas. The other similiar build-in macro function are
%quote, %nrbquote, %sysfunc(cat(...)),, etc.
People can even develop their own vararg macros that take any
number of parameters without any problems. This can be done with macro
option pbuff. For example,
You can call this macro like
%test(x1, x2, x3) or
%test(x1, x2, x3, x4, x5)
%test won't complain at all that you have assigned more parameters
that you defined.
This also remind me that if people develop vararg macros with pbuff
options, they most likely will use
%quote, %nrbquote macro functions in the implementation, they are,
however, not necessary because we alreadly have so many %Q- macros at
Have fun with vararg macros !