The SAS Output Delivery System and reporting techniques

SAS RTF footer issue with several alignments

New Contributor
Posts: 3

SAS RTF footer issue with several alignments

According to SAS documentation user can manipulate with footer easily, i.e., set different options.

footnote color=red "Red," color=white "White, and" color=blue "Blue";


Using the same approach i want to enhance my footer with several alignment options: part of the text align left, other - center/right

(  Files are generated (sample code in previous link), however if for safety reasons i compare such files (just make copy of the first one), i get msword error.


What is the cause of this msword problem: is it SAS related problem or MSword.


How to overcome the identified problem?

Super User
Posts: 13,338

Re: SAS RTF footer issue with several alignments

Without the error message it would be hard to tell.

It isn't quite clear exactly what you may be doing. It sounds like you use SAS with the ODS RTF destination to create and RTF file, then open in Word and then do a save as to create a copy. Is that correct?

New Contributor
Posts: 3

Re: SAS RTF footer issue with several alignments

The error message says:

This error message may be the result of a corrupt table in the current document. (sometimes this message pops out during comparison/trying to change footer properties in comparison screen).


In the code provided in there are two 2 different/similar footers: same lines, different order. Using the provided code You can generate 2 different RTF files. Then make copies (ctrl +c/+v) of these files and try comparing with the original files (use std msword compare functionality).


Comparing files where the last footer line combines two different text alignments gives error message (top of this message).


Hope now it is clear.

Super User
Posts: 13,338

Re: SAS RTF footer issue with several alignments

Any number of things possible, mostly related to Microsoft. If you EDIT something in Word then the codes placed are not necessarily the ones that SAS generates using RTF because Microsoft has tons of stuff. I would basically not use the Microsoft compare for something like this because you know they have changed.

When you do the edit did you turn on the very limited 'reveal codes' functionality in Word? You edit may get placed in the wrong place in relation to other features, hence the "corrupted table".

If you haven't played with low level file contents and Microsoft. Generate a VERY Small document from SAS with your footer. Then do the edit as you describe. Make sure the files are both RTF. Open them in a plain text editor such as NOTEPAD, not something that supports RTF appearance enhancements.


You may find that the editted file has a vast number of added MSformat codes inserted. And the way that the footnote gets editted, which SAS does create as a very simplistic table, has lots of code that unless you spend lots of time with the RTF specifications you won't recognize.


One option may be to use escapechar and the RAW instruction to insert RTF codes directly into SAS generated text. I have had hit-and-miss luck with getting the result I want and haven't tried this with footnotes.

Another option may be to use ODS tagsets.rtf which has a few differences for whether text is always in a table or not. May, no promises.

New Contributor
Posts: 3

Re: SAS RTF footer issue with several alignments

[ Edited ]

Dear  ,


have you checked the code i added to my post(s)? I have used the same approach as you mention: try with small example. The result i got to was described: >1 alignment in last footer line is problematic.


Using comparison - notepad/diff and other stuff - this is not the case, as i'm aiming for the text changes and MSword compare allows this functionality (comparing "source" of rtf you suggest is not the option).


First, i'm not sure if the formating approach i consider in my footers is correct. If yes, either SAS/MSword has error. If no, ideas how footer should be processed are welcome (.sas part).



FOOTNOTE1 "~{style [textdecoration=underline]Switching from underline to}

~{style [textdecoration=line_through]line-through, then}

~{style [textdecoration=overline]overline}."; - such formating works, however when i switch to text alignment/justification no formating is applied

FOOTNOTE1 "~{style [textalign=left]Switching from underline to}

~{style [textalign=center]line-through, then}

~{style [textalign=right]overline}.";

Ask a Question
Discussion stats
  • 4 replies
  • 2 in conversation