BookmarkSubscribeRSS Feed
jdankovchik
Calcite | Level 5

Hello,

 

I am trying to output a large number of tables using PROC TABULATE to a MS Word document (SAS 9.4).  Each table has its own footnote. I have used ODS RTF with bodytitle option but the footnotes are defaulting to print a couple of lines below the table, which is taking up way too much space and makes it hard to read.

 

I tried using parskip and the TAGSETS version of ODS RTF, but when I do that it only prints the last footnote - all the rest are just missing.

 

Any help would be much appreciated!  Thanks

 

-Jenine

4 REPLIES 4
Reeza
Super User

What style are you using for your ODS RTF output?

 

You can create and modify your own style that may be able to help with that, I'm not sure what the setting would be for that particular option.

 

This is my standard RTF style:

https://gist.github.com/statgeek/9603140

 

You can see the source code for a particular style using the following code:

proc template;
source style_name;
run;quit;

 

And as always the ever helpful, albiet too full of information link to the documentation. Example 7 talks about footers/headers but not sure it's the same as footnote.

http://support.sas.com/documentation/cdl/en/odsproc/67922/HTML/default/viewer.htm#p1t0ip5z3ouo89n1qb...

jdankovchik
Calcite | Level 5

Thank you for the style template Reeza.  Using your template my tables look great but the default for footnotes is still to appear a few lines below the table.  This leaves big gaps on each page and makes it really hard to read.  I want to change it so the footnote appears directly below each table.

 

I can't find any options within the style to adjust this distance.  The only thing I could find was parskip using TAGSETS, but then I lose all but the last footnote.  For some reason TAGSETS doesn't seem to allow a different footnote beneath each table.

 

-Jenine

Reeza
Super User

You should be able to specify unique footnotes per table.

Can you post some code that replicates your issue, preferably using SASHELP data sets so we can run it as well.

 

 

Also, what version of SAS do you have? 

 

I've also moved the post to the Reporting forum so hopefully someone else with more experience can help answer your question.

jdankovchik
Calcite | Level 5

Thank you, I've not posted on this forum before so I wasn't sure where to put it.  I'm using SAS 9.4.

 

Here is some code using the sashelp.class dataset that produces the "too far away" footnote version, using your style template:

 

proc template;
 define style styles.newrtf;
 parent=styles.rtf;
 style header / background = white font=(Times, 11pt, Bold);
 replace fonts /
   'TitleFont2' = ("Times",12pt,Bold Italic)
   'TitleFont' = ("Times",12pt,Bold)
   'StrongFont' = ("Times",11pt,Bold)
   'EmphasisFont' = ("Times",11pt,Italic)
   'FixedEmphasisFont' = ("Courier New, Courier",10pt,Italic)
   'FixedStrongFont' = ("Courier New, Courier",10pt,Bold)
   'FixedHeadingFont' = ("Courier New, Courier",10pt,Bold)
   'BatchFixedFont' = ("SAS Monospace, Courier New, Courier",8pt)
   'FixedFont' = ("Courier New, Courier",10pt)
   'headingEmphasisFont' = ("Times",12pt,Bold Italic)
   'headingFont' = ("Times",11pt,Bold)
   'docFont' = ("Times",9pt);
replace Table from Output /
rules = all
cellspacing = 0.5pt
cellpadding = 2.0pt;
end;
run;

data work.class; set sashelp.class;
  overall=1;
run;

ods listing close;
ods rtf file="C:\Users\jdankovchik\Desktop\sample_rtf.rtf" style=styles.newrtf bodytitle keepn startpage=no;


proc tabulate data=work.class missing; keylabel all="TOTAL";  
  class sex /  S=[background=lightblue font_weight=bold just=left];
  classlev sex overall/style=[cellwidth=4 in asis=on];
  VAR OVERALL;
  tables sex all, overall=''*(n*f=4.0 colpctn='(%)'*f=pctfmt.)/misstext='0' rts=15 box=[label="Testing Table 1" style=[font_size=12pt]];   
  keyword all / style={font_style=italic};
  footnote "Testing Footnote 1";
run;

proc tabulate data=work.class missing; keylabel all="TOTAL";
  class age / S=[background=lightblue font_weight=bold just=left];
  classlev age overall/style=[cellwidth=4 in asis=on];
  VAR OVERALL;
  tables age all, overall=''*(n*f=4.0 colpctn='(%)'*f=pctfmt.)/misstext='0' rts=15 box=[label="Testing Table 2" style=[font_size=12pt]];   
  keyword all / style={font_style=italic};
  footnote "Testing Footnote 2";
run;


ods rtf close;
ods listing;

 

And here is the only way I figured out to adjust the distance between table and footnote, again using your style template but adding parskip and then using ODS TAGSETS.RTF.  But as you see with this one, altough the footnote is now in a sensible place, only the last table gets its footnote.  The rest are just missing. 

 

proc template;
 define style styles.newrtf2;
 parent=styles.rtf;
 style header / background = white font=(Times, 11pt, Bold);
 style parskip / fontsize = 6pt;
 replace fonts /
   'TitleFont2' = ("Times",12pt,Bold Italic)
   'TitleFont' = ("Times",12pt,Bold)
   'StrongFont' = ("Times",11pt,Bold)
   'EmphasisFont' = ("Times",11pt,Italic)
   'FixedEmphasisFont' = ("Courier New, Courier",10pt,Italic)
   'FixedStrongFont' = ("Courier New, Courier",10pt,Bold)
   'FixedHeadingFont' = ("Courier New, Courier",10pt,Bold)
   'BatchFixedFont' = ("SAS Monospace, Courier New, Courier",8pt)
   'FixedFont' = ("Courier New, Courier",10pt)
   'headingEmphasisFont' = ("Times",12pt,Bold Italic)
   'headingFont' = ("Times",11pt,Bold)
   'docFont' = ("Times",9pt);
replace Table from Output /
rules = all 
cellspacing = 0.5pt
cellpadding = 2.0pt;
end;
run;

data work.class; set sashelp.class;
  overall=1;
run;


ods listing close;
ods tagsets.rtf file="C:\Users\jdankovchik\Desktop\sample_rtf.rtf" style=styles.newrtf2 startpage=no;


proc tabulate data=work.class missing; keylabel all="TOTAL";  
  class sex / S=[background=lightblue font_weight=bold just=left]; 
  classlev sex overall/style=[cellwidth=4 in asis=on]; 
  VAR OVERALL;
  tables sex all, overall=''*(n*f=4.0 colpctn='(%)'*f=pctfmt.)/misstext='0' rts=15 box=[label="Testing Table 1" style=[font_size=12pt]];   
  keyword all / style={font_style=italic};
  footnote "Testing Footnote 1";
run; 

proc tabulate data=work.class missing; keylabel all="TOTAL"; 
  class age /  S=[background=lightblue font_weight=bold just=left]; 
  classlev age overall/style=[cellwidth=4 in asis=on]; 
  VAR OVERALL;
  tables age all, overall=''*(n*f=4.0 colpctn='(%)'*f=pctfmt.)/misstext='0' rts=15 box=[label="Testing Table 2" style=[font_size=12pt]];   
  keyword all / style={font_style=italic};
  footnote "Testing Footnote 2";
run; 


ods rtf close;
ods listing;

I appreciate any insight you may have!  Thanks very much

 

-Jenine

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3627 views
  • 0 likes
  • 2 in conversation