ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
Garyho
Calcite | Level 5
proc template;
    define style tfl_table;
        style body /
            leftmargin = 1in
            rightmargin = 1in
            topmargin = 0.5in
            bottommargin = 0.5in;
        style table /
            frame = hsides
            rules = groups
            cellpadding = 3pt
            cellspacing = 0pt
            width = 100%;
        style header /
            /*This is the header line for the table.*/
            fontfamily = 'Courier New'
            fontsize = 9pt;
        style data /
            /*This is the data in the table.*/
            fontfamily = 'Courier New'
            fontsize = 9pt;
        style SystemTitle /
            fontfamily = 'Courier New'
            color = red
            fontsize = 10pt;
        style systemfooter /
            /*This affects the text in footnoteX statement.*/
            textalign = left
            fontfamily = 'Courier New'
            fontsize = 9pt;
        style NoteContent from Note /
            /*change the font in the compute line*/
            textalign = left
            fontsize = 9pt
            fontfamily = 'Courier New';
    end;
run;

ods html close;
ods rtf file = "&dir.\test-run.rtf" bodytitle style = tfl_table;
ods escapechar = '^';

title1 'First Title with title1 statement';
title2 'Second Title with title2 statement';
footnote1 'footnote1 with footnote1 statement';
footnote2 'footnote2 with footnote2 statement';

proc report data = sashelp.class nowd;
    column sex name age height weight;
    define sex / group;
    break after sex / page;
run;
ods rtf close;

title;
footnote;

I wrote a template to create table.. There are a few question: headers and footnotes are separated from the main table by a blank line or two. How can I  remove the blank line between the footnotes and the main table?

4 REPLIES 4
ballardw
Super User

Only the footnotes and the space between the Title and the table?

 

The PARSKIP style attribute in the style template controls the default space between titles and footnotes.

 

You would have a line similar to

style parskip / fontsize = 1pt;

in your style template to have the space reduced to 1pt between the titles, footnote and the table.

 

Alternate, which doesn't allow quite the appearance options is to use the POSTTEXT style option.

proc report data=sashelp.class  
  style=[posttext='something following']
;
   columns name sex age;
   define sex/display;
   define age/display;
run;

The Posttext, and the Pretext that would precede a table, does not have any persistence like title and footnote, does not incorporate many of the appearance options of title/ footnote and pretty much only allows one element, i.e. all the text goes in one posttext text content. But the text does appear immediately after/before the table.

 

I find Pretext/Posttext more helpful in Proc Tabulate which can create multiple tables as the style is applied per single table as an option.

Ksharp
Super User

ballardw,

When I using style=journal within RTF and got this weird result . Any idea ?

 

ods rtf file = "c:\temp\test-run.rtf" bodytitle style = journal ;
title;
footnote;
proc report data = sashelp.class nowd 
style=[pretext='something following'  posttext='something following' fontsize=6];
    column sex name age height weight;
    define sex / group;
    break after sex / page;
run;
ods rtf close;

Ksharp_0-1648377181449.png

 

yabwon
Onyx | Level 15

for tagset.rtf there is OPTIONS(vspace="NO"):

ods tagsets.rtf file = "&dir.\test-run.rtf" style = tfl_table OPTIONS(vspace="NO");

B.

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Ksharp
Super User

Or Try this one ?

 

proc template;
    define style tfl_table;
        style body /
            leftmargin = 1in
            rightmargin = 1in
            topmargin = 0.5in
            bottommargin = 0.5in;
        style table /
            frame = hsides
            rules = groups
            cellpadding = 3pt
            cellspacing = 0pt
            width = 100%;
        style header /
            /*This is the header line for the table.*/
            fontfamily = 'Courier New'
            fontsize = 9pt;
        style data /
            /*This is the data in the table.*/
            fontfamily = 'Courier New'
            fontsize = 9pt;
        style SystemTitle /
            fontfamily = 'Courier New'
            color = red
            fontsize = 10pt;
        style systemfooter /
            /*This affects the text in footnoteX statement.*/
            textalign = left
            fontfamily = 'Courier New'
            fontsize = 9pt;
        style NoteContent from Note /
            /*change the font in the compute line*/
            textalign = left
            fontsize = 9pt
            fontfamily = 'Courier New';
    end;
run;
ods rtf file = "c:\temp\test-run.rtf" bodytitle style = tfl_table ;

title;
footnote;

proc report data = sashelp.class nowd;
    column sex name age height weight;
    define sex / group;
    break after sex / page;
compute before _page_/
style={just=l bordertopwidth=2 bordertopcolor=white borderbottomwidth=2 borderbottomcolor=black};
line 'First Title with title1 statement';
line 'Second Title with title2 statement';
endcomp;
compute after sex/
style={just=l bordertopwidth=2 bordertopcolor=black borderbottomwidth=2 borderbottomcolor=white};
line 'footnote1 with footnote1 statement';
line 'footnote1 with footnote1 statement';
endcomp;
run;
ods rtf close;

Ksharp_0-1648379058389.png

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 4 replies
  • 2525 views
  • 1 like
  • 4 in conversation