The SAS Output Delivery System and reporting techniques

Gap between ODS Text and Report using ODS RTF

Accepted Solution Solved
Reply
Contributor
Posts: 45
Accepted Solution

Gap between ODS Text and Report using ODS RTF

Hello,

I have the following code that generates two ODS TEXT lines and two Proc Report tables on the same page. I'm curious why there is a gap (extra line?) between the 2nd TEXT line and the 2nd report

Any info would be appreciated.

Thanks

ods escapechar = '^' ;

ods rtf

            file  = "/opt/local/user/test.rtf"

            style=styles.sasweb

            startpage = no               ;

ods text="^S={just=c fontweight=bold fontsize=12pt color=black}First Report";

proc report data = sashelp.cars(obs=10) nowd ;

            column make model type ;

            define make                  / 'Make' display ;

            define model      /           'Model' display;

            define type                    / 'Type' display;

run ;

ods text="^S={just=c fontweight=bold fontsize=12pt color=black}2nd Report";

proc report data = sashelp.cars(firstobs=11 obs=21) nowd ;

            column make model type ;

            define make                  / 'Make' display ;

            define model      /           'Model' display;

            define type                    / 'Type' display;

run ;

ods rtf close;


Accepted Solutions
Solution
‎05-04-2012 06:52 PM
SAS Super FREQ
Posts: 8,866

Re: Gap between ODS Text and Report using ODS RTF

Posted in reply to Jay_TxOAG


Hi:

  Look up this (https://communities.sas.com/message/17706#17706) and other previous forum postings on the use of the PARSKIP style attribute, along with the new TAGSETS.RTF destination. You cannot reduce the amount of white space between tables and other document "elements"  using the original ODS RTF destination, because the amount of space was fixed. However, with ODS TAGSETS.RTF (if you are running SAS 9.2 or higher), you can alter some of the style attributes in a style template, especially the PARSKIP attribute in order to reduce the white space.

  That gap or seeming extra line actually comes from a section break that is used to separate the user text from the beginning of the table.

  Another alternative would be to get rid of the ODS TEXT= statements and use PROC REPORT COMPUTE block statements, such as:

compute before _page_ / style={just=c fontsize=12pt fontweight=bold color=black};

   line 'First Report';

endcomp;

cynthia

View solution in original post


All Replies
Super User
Posts: 11,343

Re: Gap between ODS Text and Report using ODS RTF

Posted in reply to Jay_TxOAG

I think it is because there are two lines between tables or possible one after and one before each table. Try the code without the 2nd Report line. I suspect that the ods text is inserted after the end of the first and before the start of the second blank.

Those 2 blank lines are apparently not controlable from an old thread where I asked about removing one of them.

Insted of the ODS TEXT you could try using the style override with PRETEXT. on the PROC REPORT statement add:

style(report) = [ pretext="2nd Report"]

to see where that text goes.

I haven't had a lot of luck overriding the text component with PRETEXT though.

Solution
‎05-04-2012 06:52 PM
SAS Super FREQ
Posts: 8,866

Re: Gap between ODS Text and Report using ODS RTF

Posted in reply to Jay_TxOAG


Hi:

  Look up this (https://communities.sas.com/message/17706#17706) and other previous forum postings on the use of the PARSKIP style attribute, along with the new TAGSETS.RTF destination. You cannot reduce the amount of white space between tables and other document "elements"  using the original ODS RTF destination, because the amount of space was fixed. However, with ODS TAGSETS.RTF (if you are running SAS 9.2 or higher), you can alter some of the style attributes in a style template, especially the PARSKIP attribute in order to reduce the white space.

  That gap or seeming extra line actually comes from a section break that is used to separate the user text from the beginning of the table.

  Another alternative would be to get rid of the ODS TEXT= statements and use PROC REPORT COMPUTE block statements, such as:

compute before _page_ / style={just=c fontsize=12pt fontweight=bold color=black};

   line 'First Report';

endcomp;

cynthia

Contributor
Posts: 45

Re: Gap between ODS Text and Report using ODS RTF

Posted in reply to Cynthia_sas

Cynthia,

Thanks for the reply. I will take some time to investigate TAGSETS.RTF, although right now it makes more changes to my code than I have time to fix.

However, I like the COMPUTE BEFORE _PAGE_ idea and altered my code to take advantage of this.

My only problem is getting a black line between the text and headers in the 2nd report...to match the 1st report.

Do you know how to effect the top border of the header? (borderbottomcolor=black in the compute statement does not give me a black line above the header)

ods escapechar = '^' ;

ods rtf

            file  = "/opt/local/user/jsc/test.rtf"

            style=styles.sasweb

            startpage = no               ;

ods text="^S={just=c fontweight=bold fontsize=12pt color=black}First Report";

proc report data = sashelp.cars(obs=10) nowd ;

            column make model type ;

            define make                  / 'Make' display ;

            define model      /           'Model' display;

            define type                    / 'Type' display;

run ;

/*ods text="^S={just=c fontweight=bold fontsize=12pt color=black}2nd Report";*/

proc report data = sashelp.cars(firstobs=11 obs=21) nowd ;

            column make model type ;

            define make                  / 'Make' display ;

            define model      /           'Model' display;

            define type                    / 'Type' display;

            compute before _page_ /

                        style={just=c borderTopcolor=white borderRightcolor=white borderleftcolor=white borderbottomcolor=black fontweight=bold fontsize=12pt color=black} ;

                        line '2nd Report';

            endcomp;

run ;

ods rtf close;

SAS Super FREQ
Posts: 8,866

Re: Gap between ODS Text and Report using ODS RTF

Posted in reply to Jay_TxOAG

Hi:

This is puzzling. Perhaps you should work with Tech Support. As you can see from the screenshot, I don't get a black line underneath the first string written with ODS TEXT, so I don't know what it is that you want for the second header. There is some extra space which comes from the placement of the section break control. The only thing I did was to limit the number of obs so that both tables could fit into 1 screen shot. (I ran the code in SAS 9.3 and took the screen shot using Microsoft Word 2002 using Print Preview -- not on my regular machine with Word, but this machine has 9.3 of SAS.)

cynthia


text_and_compute.jpg
Contributor
Posts: 45

Re: Gap between ODS Text and Report using ODS RTF

Posted in reply to Cynthia_sas

Thanks Cynthia. Your screen shot looks the same as what I got. I would like to get a black line (border) below the 2nd ODS TEXT (which is the top of the headers in the 2nd report). I will follow up with tech support.

Jay

SAS Super FREQ
Posts: 8,866

Re: Gap between ODS Text and Report using ODS RTF

Posted in reply to Jay_TxOAG

Ah, I thought you were saying that you SAW a black line, not that you WANTED one. When I wrote my program I did NOT use ODS TEXT= for the 2nd Report's header. That is placed with a COMPUTE BEFORE. There is a text-decoration style attribute that you could use. I think it is: textdecoration=underline It would go into the STYLE= overrides on the COMPUTE BEFORE statement. Just remember that usually the bottom of one cell is the top of another cell. So in some destinations, where the 2 cells meet, you have to change not just the bottom of one, but you have to change the top of the other. So, it's possible that TEXTDECORATION may work better for you.

Just remember that the COMPUTE BEFORE string is centered on top of the table, but "lives" within the boundaries of the table, so underlining the cell words will work. Underlining from margin to margin will not work.

cynthia

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 3236 views
  • 1 like
  • 3 in conversation