LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 8 Dec 2005 10:41:46 -0800
Reply-To:   lzhang9830@YAHOO.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Lei Zhang <lzhang9830@YAHOO.COM>
Subject:   Re: Macro quoting essentials
Comments:   To:
In-Reply-To:   <BAY101-F36C056B88F0F8D8E8B675EDE420@phx.gbl>
Content-Type:   text/plain; charset="iso-8859-1"

Hi, Toby, 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, %macro test(X)/pbuff; %put &x; %mend; 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 hand.

Have fun with vararg macros !


Back to: Top of message | Previous page | Main SAS-L page