LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (January 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 5 Jan 2009 16:21:25 -0600
Reply-To:     Joe Matise <snoopy369@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Matise <snoopy369@GMAIL.COM>
Subject:      Re: Need help creating macro string for ODS RTF TEXT statement
Comments: To: David Ryerson <ryersondg@yahoo.com>
In-Reply-To:  <200901052150.n05HbGwN023870@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1

If I had to guess, I'd say look at your quoting - particularly whether it might be better to use some of the other %str-like macro functions, ie %nrstr or %quot, etc.

It may be the nested %str in wholestring - i'm not sure that is going to behave quite like you expect it to.

-Joe

On Mon, Jan 5, 2009 at 3:50 PM, David Ryerson <ryersondg@yahoo.com> wrote:

> I have the following SAS code which works on its own (no macro) > > ods results on; > ods rtf > body="C:\test.rtf"; > ods rtf text = '~R/RTF" \pard \phmrg\posxc \qc\fs36\b " What a > Great Title ~R/RTF" \par "' ; > proc print data=sashelp.class; > run; > ods rtf close; > > I would like to be able to parameterize the rtf string so that a user > could control alignment, bolding, fontsize, etc. In the macro I created, > the string that gets created either causes an error like: > > MPRINT(INSERTTEXT): ods rtf text = '~R/RTF" \pard \phmrg\posxc \qc\fs36 > \b " What a Great Title ~R/RTF" \par "'; > > ERROR 22-322: Expecting a quoted string. > ERROR 200-322: The symbol is not recognized and will be ignored. > > This is especially frustrating since the resolved macro variable is > exactly what I manually entered in the ods rtf text = statement above. So > what's the difference between executing it as SAS code and letting the > macro processor resolve it into SAS and then having SAS executing it? > It's the same thing right? (clearly it's not ;-) > > Here's a simplified version of the macro: > > %macro insertText(text, justify, fontSize, bold); > ods escapechar="~"; > > %let startRtf = %str(%'~R/RTF%" \pard \phmrg\posxc ); > %let fontConfig = %str(\q&justify.\fs&fontSize.\&bold %" ); > %let endRtf = %str(~R/RTF%" \par %"%'); > %let wholeString = %str(ods rtf text = &startRtf&fontConfig%str( > &text )&endRtf;); > %str(&wholeString); > %mend insertText; > ods rtf > body="C:\test.rtf"; > %insertText(What a Great Title, c, 36, b) > proc print data=sashelp.class; > run; > ods rtf close; > > MPRINT(INSERTTEXT): ods rtf text = '~R/RTF" \pard \phmrg\posxc \qc\fs36 > \b " What a Great Title ~R/RTF" \par "'; > > ERROR 22-322: Expecting a quoted string. > ERROR 200-322: The symbol is not recognized and will be ignored. > > I should have mentioned at the top, I know there are easier ways to enter > a title with formatting (~S={}, justify=left, etc.), but I need the user > to be able to enter this anywhere in an RTF document, not just the title > of a proc. > > TIA, > Dave >


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