Date: Wed, 21 Jan 2004 15:56:39 -0500
Reply-To: Don Stanley <don_stanley@PARADISE.NET.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Don Stanley <don_stanley@PARADISE.NET.NZ>
Subject: Tip: Correct Syntax For Embedding RTF Characters In PROC REPORT
Output
When you embed raw RTF output in PROC REPORT (or indeed anywhere in your
SAS output), ensure you leave a space after the raw RTF codes. Otherwise,
when your RTF viewer (eg WORD) reads the RTF file, it may not understand
what the RTF command is. In that situation, the RTF command is ignored
(because the RTF viewer sees a different, usually invalid command).
Example:
This will not work.
data show ; x=1; y=1 ; run ;
proc format ; value dummy 1='hello' ; run ;
ods rtf file='c:\test.rtf' ;
proc report data=show nowd missing ;
column x y ;
compute before _page_ / style={protectspecialchars=off just=left} ;
test=1 ;
line 'I want to say \tab' test dummy. ;
endcomp ;
run ;
ods rtf close ;
because there is no blank after the \tab. Your RTF viewer will see
\tabhello which is invalid RTF.
However this works as expected:
data show ; x=1; y=1 ; run ;
proc format ; value dummy 1='hello' ; run ;
ods rtf file='c:\test.rtf' ;
proc report data=show nowd missing ;
column x y ;
compute before _page_ / style={protectspecialchars=off just=left} ;
test=1 ;
line 'I want to say \tab ' test dummy. ;
endcomp ;
run ;
ods rtf close ;
Notice the space after \tab.
Another golden rule, if you have to embed raw RTF commands, ensure you
leave a space at the end. Note that when following the RTF command by a
variable value, sometimes you may get spaces at the beginning of the
variable, which has the same effect ...
Don