BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
M26
Fluorite | Level 6 M26
Fluorite | Level 6

I output a plot to RTF (MS Word) and the header and footer are 2.54 cm in height.

 

The plot is crowded, so I want to decrease the header and footer (to say 1.27 cm) so that the body can grow for the plot.

 

I have tried to look for a solution online and I have been thinking that it would be something to do with proc template define style.

 

The attachments show what I mean in MS Word and my setup in proc template define style class for the adjustment of the top, right, bottom & left margins (which doesn't work as I thought it would). 

 

Should I be working with the 'systemheader' and 'systemfooter' rather? Or something else? Can the MS Word header and footer actually be modified in this manner?

 

I am familiar with RTF codes \qc etc.;, so would that be an option?

 

I have also tried adding the 'bodytitle' to the ODS RTF statement to make the title appear in the document body (thinking it might majically make the header and footer disappear 😄 ) but it obviously has no effect on the size of the header/footer.

 

Any advice would be very much appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Here's a response from 2011: https://communities.sas.com/t5/ODS-and-Base-Reporting/What-does-HEADERY-do/td-p/13613 and here is the original TS note: https://support.sas.com/kb/24/168.html . My understanding from the "old" days talking to the ODS developers when ODS RTF first came out was that some ODS measurements in RTF end up being converted into TWIPS when the RTF file is created because ODS generates RTF control strings and the RTF control strings expect the measurements to be specified in TWIPS.

 

  HEADERY and FOOTERY were NOT in the original ODS RTF set of options, (I think they were introduced in SAS 9.1 approx) and since they are so specific to ODS RTF and how the document is rendered in Word, at some point the decision must have been made to specify them in TWIPS. The "why" is a mystery to me.

 

  What I observe is that if I do a simple ODS RTF with 1 inch margins and no specification for HEADERY and FOOTERY, all of the measurements in the generated RTF file seem to be in TWIPS, and it looks like HEADERY and FOOTERY are set to be 1440, as shown below:

Cynthia_sas_0-1689168549140.png

When I specify values for HEADERY and FOOTERY, my values go directly into the RTF file, as shown below:

Cynthia_sas_1-1689168719391.png

  Hope this helps,

Cynthia

View solution in original post

8 REPLIES 8
M26
Fluorite | Level 6 M26
Fluorite | Level 6

How does one edit an own post? Never mind ... found it! 😄

Ksharp
Super User
options nonumber nodate topmargin=0cm bottommargin=0cm;
ods rtf file='c:\temp\temp.rtf' headery=1 footery=1 ;
title 'XXXXXXXXX';

ods graphics/outputfmt=png noborder;
proc sgplot data=sashelp.heart(obs=100) ;
scatter x=weight y=height/group=sex;
run;

ods rtf  close;

Ksharp_0-1689075684244.png

 

M26
Fluorite | Level 6 M26
Fluorite | Level 6

Thank you KSharp! I have seen many of your responses on the forum. It's a please to have address my query! 🙂

I can't quite understand the difference between using the 'options topmargin=1.27cm bottommargin=1.27cm' and using 'ods rtf ... headery=720 footery=720'. Is it just that the ods options allows you use inches or cms and RTS headery/footery you must use twips?

Thanks again for the answer! I really appreciate it! 😄

Ksharp
Super User

Maybe @Cynthia_sas could give you more details info. Here is what I get.

 

Ksharp_0-1689161954876.png

 

Cynthia_sas
SAS Super FREQ

Hi:

  Here's a response from 2011: https://communities.sas.com/t5/ODS-and-Base-Reporting/What-does-HEADERY-do/td-p/13613 and here is the original TS note: https://support.sas.com/kb/24/168.html . My understanding from the "old" days talking to the ODS developers when ODS RTF first came out was that some ODS measurements in RTF end up being converted into TWIPS when the RTF file is created because ODS generates RTF control strings and the RTF control strings expect the measurements to be specified in TWIPS.

 

  HEADERY and FOOTERY were NOT in the original ODS RTF set of options, (I think they were introduced in SAS 9.1 approx) and since they are so specific to ODS RTF and how the document is rendered in Word, at some point the decision must have been made to specify them in TWIPS. The "why" is a mystery to me.

 

  What I observe is that if I do a simple ODS RTF with 1 inch margins and no specification for HEADERY and FOOTERY, all of the measurements in the generated RTF file seem to be in TWIPS, and it looks like HEADERY and FOOTERY are set to be 1440, as shown below:

Cynthia_sas_0-1689168549140.png

When I specify values for HEADERY and FOOTERY, my values go directly into the RTF file, as shown below:

Cynthia_sas_1-1689168719391.png

  Hope this helps,

Cynthia

M26
Fluorite | Level 6 M26
Fluorite | Level 6

Wow! Another legend! 😄 Thank you  @Cynthia_sas  for the response, it's very much appreciated. And thanks @Ksharp for the referral! 😄

 

TIL:

  1. 1440 twips per inch - I have been using centimeters rather than inches so I've been using the following to calculate the number of twips: 567 x cms = # of twips
  2. "headery" & "footery" override "topmargin" and "bottommargin" options if set
  3. "bodytitle" can be used if you'd prefer the header to be in the body, rather than the document header, of the document
  4. Maybe changing the "papersize" option to A3 can give you more real estate to play with so that you don't have to adjust other things

 

Unfortunately, the link on the TS note page is dead i.e., https://support.sas.com/rnd/base/ods/odsrtf/rtf901.html. How does one get that fixed?

 

Thanks again for your responses.

Michael

Cynthia_sas
SAS Super FREQ
Hi: I believe that link was the original 9.1 link when the ODS RTF features were still experimantal -- like BODYTITLE, etc. All of those features are now production. So even though the link is broken, my guess is that the "experimental" page was removed when all the features were made production.
Cynthia
M26
Fluorite | Level 6 M26
Fluorite | Level 6
Okay, thanks for the follow-up. Makes sense in that context.

Thanks again for your help! 😄
Michael

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2794 views
  • 8 likes
  • 3 in conversation