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 (May 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 13 May 2009 15:59:07 -0400
Reply-To:     Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject:      Re: Macro quoting again !
Comments: To: Ya Huang <ya.huang@AMYLIN.COM>

On Wed, 13 May 2009 13:52:29 -0400, Ya Huang <ya.huang@AMYLIN.COM> wrote:

>Hi there, > >Macro a with a get the result as expected. But macro b >is not, why is that? > >Thanks > >Ya > >1 %macro a(tit=); >2 %put &tit; >3 %mend; >4 >5 %a(tit=%str(Change %(%%%))); >Change (%) >6 >7 %macro b(mlst=); >8 %unquote(&mlst); >9 %mend; >10 >11 %b(mlst=%nrstr( >12 %a(tit=%str(Change %(%%%))) >13 ));

Hi, Ya, The following works. you don't need to mask parens with a percent sign when the parentheses are balanced. But since the inner most text string quoted by %str is processed twice(once by &mlst and another by &tit), you need to double up the percent sign. You can also get rid of some unnecessary semi- colons. hth. Cheers, Chang

%macro a(tit=); %put &tit; %mend a; %macro b(mlst=); %unquote(&mlst) %mend b; %b(mlst=%nrstr( %a(tit=%str(Change (%%%%))) )) /* on log Change (%) */


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