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 (April 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 25 Apr 2003 15:47:43 -0400
Reply-To:     Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:      Re: centering macro text in a title statement where the text leng
              th i s variable
Comments: To: "Igra, Amnon" <Amnon.Igra@CORR.CA.GOV>
Content-Type: text/plain

Amnon,

You must hide single quotes and double quotes from the macro facility when they do not occur in pairs. Te easies way to do this is to enclose the text field in %STR(...) and change any ' to %' and any " to %". for example I tested with

%put %justify(%str(jello%'s jolly, or molly) ,padchar= %str( )) ;

and

data w ; x = 1 ; run ; title "%justify(%str(jello%'s jolly, or molly))" ; options nocenter ; proc print data = w ; run ;

IanWhitlock@westat.com -----Original Message----- From: Igra, Amnon [mailto:Amnon.Igra@CORR.CA.GOV] Sent: Friday, April 25, 2003 12:27 PM To: SAS-L@LISTSERV.UGA.EDU Subject: centering macro text in a title statement where the text length i s variable

The following macro, adapted from Ian Whitlock's, works, to center text, as I needed, in a Title statement. However, some of my text has single quotes in it, and the macro balks at that. Anyone have any suggestions? I'm not extremely familiar with all the macro quoting functions.

Thanks for your help.

Amnon Igra

*=======================================================; %MACRO JUSTIFY (TEXT,PADCHAR = %STR( ) ) ; %LOCAL NP PAD ; %LET NP = %EVAL (100 - %LENGTH (&TEXT) ) ; %LET PAD = %QSYSFUNC ( REPEAT ( &PADCHAR , &NP - 1 ) ) ; %LET TEXT= %QSUBSTR(&PAD,1,&NP/2)&TEXT%QSUBSTR(&PAD,1,&NP/2); &TEXT %MEND JUSTIFY ; *=======================================================;


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