The SAS Output Delivery System and reporting techniques

ODS RTF v DDE output file size

Not applicable
Posts: 0

ODS RTF v DDE output file size

When generating output with ODS RTF the size of the output file that is generated is considerably larger than that produced using DDE. Has anyone else noticed this? Can the output file size be reduced?
Posts: 9,365

Re: ODS RTF v DDE output file size

Posted in reply to deleted_user
When I use the following program to send SASHELP.SHOES to 3 different destinations (sorry, I don't have a DDE program that creates an RTF/DOC file):
ods rtf file='c:\temp\shoes.rtf';
ods pdf file='c:\temp\shoes.pdf' compress=9;
ods chtml file='c:\temp\shoes.html';
proc print;
ods _all_ close;
I get the following sizes:

When I open SHOES.RTF with Word and RESAVE it as a .DOC file, the resulting
Word file is actually LARGER.
[pre]SHOES.DOC = 659 KB[/pre]

This has ALWAYS been my experience -- that the ODS RTF file is generally smaller than the same ODS RTF file re-saved as a Word Doc. I don't know what DDE is doing that is making the Word doc smaller in size. Perhaps DDE is generating very "spare" RTF or Word document instructions with no formatting or not in tables. But without knowing what the DDE process is or is not adding to your data or procedure output, it's very hard to compare ODS RTF to DDE. Does your DDE output look EXACTLY like the ODS RTF output or vice versa?

ODS PDF does have a compress option. COMPRESS=9 is the highest level of compression and as you can see, that makes the PDF file smaller than the HTML file that was created with the CHTML destination (CHTML is a destination that creates very, very plain HTML -- without any styles used.)

If I create the output file so there is no TABLE created for the report:
ods listing file='c:\temp\shoes.txt';
proc print;
ods _all_ close;

Then [pre]SHOES.TXT = 45 KB [/pre] in size (the smallest size of all ODS output -- but as I said, every "row" is just one line in the Word doc ... there is no TABLE structure added.) However, if I just re-save this LISTING file as a Word doc, then the file size is: [pre]SHOES_TXT.DOC = 79 KB [/pre] -- still with no table structure, however, you can see that just saving the equivalent of the plain text file as a Word doc, did add some overhead to the file size -- that's because the Word format is proprietary. RTF, in my experience is verbose, but still generally smaller than a WORD doc. However, since the RTF is just an ASCII text file, it does ZIP or compress nicely.

Depending on what your DDE file is creating, perhaps it comes down to the formatting that's added by ODS RTF to make the report table be a table and look nice in Word. What happens if you open the DDE-created file with Word and then resave the file as a Word doc?? Does the file size get bigger or smaller?

You could switch to ODS CHTML or ODS PDF for your output if you want to get a smaller file. The HTML file created with ODS CHTML -will- open in Word 97 and higher. It'll be pretty plain, although the rows will still be in a TABLE. If you added a style template into the mix (ODS MSOFFICE2K creates Microsoft-flavor HTML):
ods msoffice2k file='c:\temp\shoes_rtfstyle.html' style=rtf;
proc print;
ods _all_ close;

Then the resulting HTML file get MUCH bigger (more than double but the HTML file is STILL smaller than the same file created with ODS RTF):
SHOES.RTF = 486 KB (uses RTF control strings)
SHOES_RTFSTYLE.HTML = 219 KB (HTML version of RTF file using RTF style)
SHOES.HTML = 87 KB (Plain, compact HTML file)

So you can see, it's hard to compare the ODS RTF file with the DDE file without knowing how much "style" information the DDE file is creating.

Not applicable
Posts: 0

Re: ODS RTF v DDE output file size

Posted in reply to Cynthia_sas

Thanks for reply.

We are using SAS version 8.2 to generate our outputs.

Some of the listings that we are producing are approx. 2000 pages and when creating the output using ODS RTF we using proc report to generate the listings a using the by page logic. This is so we can determine the maximum number of pages within he page x of y title to save rtf trying to paginate the report and so we can see a solid line at the bottom of the output within each page.

We are adapting the RTF style:
** create template for post-text tables **;
define style Styles.ods_pt /store=util.template;
replace fonts/
'TitleFont2' = ("Courier New ",9pt ) /*procedure titles*/
'TitleFont' = ("Courier New ",9pt ) /*title */
'FootnoteFont' = ("Courier New ",9pt ) /*footnote */
'StrongFont' = ("Courier New ",9pt ) /*page numbers*/
'EmphasisFont' = ("Courier New ",9pt )
'FixedEmphasisFont' = ("Courier New ",9pt )
'FixedStrongFont' = ("Courier New ",9pt)
'FixedHeadingFont' = ("Courier New ",9pt)
'BatchFixedFont' = ("Courier New ",9pt )
'FixedFont' = ("Courier New ",9pt )
'headingEmphasisFont' = ("Courier New ",9pt )
'headingFont' = ("Courier New ",9pt ) /*table header*/
'docFont' = ("Courier New ",9pt );
** added 14May2005 **;
replace systemtitle from systemtitle /
replace document from container /
asis = on
replace SystemFooter from TitlesAndFooters /
asis = on
protectspecialchars = on
font= Fonts('FootnoteFont');
replace systemtitle from titlesandfooters/
asis = on
replace body from document /
asis = on;
replace color_list
"Colors used in the default style" /
'link'= blue
'bgH'= white
'fg' = black
'bg' = white;
replace Table from output /
cellpadding = 0pt
style Header from Header /
style Rowheader from Rowheader /
replace pageno from titlesandfooters/

When we are producing the output using DDE, we first generate the table to a list file and then use DDE to save the file as a RTF file.

The file created using ODS is 40,500 kb and the DDE version is 7,756 kb. Also word takes a long time to open the ODS version.

Is the increase in size due to word creating a table per page?
Posts: 9,365

Re: ODS RTF v DDE output file size

Posted in reply to deleted_user
I don't know the answer to your question. As I said before...using DDE and using ODS are two different processes and the size that ODS generates is the size of file that ODS generates -- I believe there's little you can to to cut down the RTF control strings that are being written (especially in SAS 8.2). With the need to have Page X of Y page numbering, I understand why you can't move to HTML and in SAS 8.2, the PDF page numbering was not as smooth as the RTF page numbering.

All I can offer is the method I used in SAS 8.2 to do a line above the footnote and to do page X of Y numbering.

(I did not know there was a way to prevent Word from repaginating when the RTF file opened. I thought that was a "feature" of Word.)

As you can see, in my code, I use the PAGE option on the BREAK statement in this example, but the program could be modified to do BY group processing too.

I'm not sure there's any thing in ODS that's making Word take a long time to open a file. Somebody sent me a book manuscript in Word format one was only 300 pages, and I ended up taking a lunch break while Word opened and repaginated the file. I can only imagine how long Word will take to open 2000 pages.

However, at this point, I think the people best qualified to work with you on your question are the folks in Tech Support. I just don't use DDE, or know it well enough to make an intelligent contribution toward answering your question.

** here is my method of putting a line above each footnote and doing Page X of Y page numbering in SAS 8.2;

options nodate nonumber;

%let t3=%str(Table Number 1.0);
%let t4=%str(Listing of Serious Adverse Events);
%let t5=%str(Population: XXXXX);

title1 j=l font='Arial' h=10.1pt
%nrstr("Report R&D")
j=r font='Arial' h=10.1pt
"%sysfunc(datetime(), datetime16.)";

title3 j=c font='Arial' h=10.1pt "&t3.";
title4 j=c font='Arial' h=10.1pt "&t4.";
title5 j=c font='Arial' h=10.1pt "&t5.";

**make sure there is a SPACE between the 1 and the quote;
** in the footnote below;
** footnote1 is the LINE;
footnote j=l font='Arial' h=10.1pt
"^S={protectspecialchars=off "
"pretext='\brdrt\brdrs\brdrw1 '}"

** footnote 2 is the page x of y string;
footnote2 j=r
"{\field{\*\fldinst{\b\i PAGE}}}\~{\b\i of}\~{\field{\*\fldinst{\b\i NUMPAGES}}}";

ods listing close;

ods rtf file='c:\temp\examp.rtf' style=journal;
ods escapechar='^';
proc report nowd
style(report)={rules=groups frame=hsides
cellspacing=0 cellpadding=2pt};
where region in ('Asia', 'Canada');
column region product sales;
define region /group noprint;
define product /order 'Region/Product'
style(column)={indent=20 cellwidth=1.5in};
define sales /sum;
break after region / summarize page;
compute before region /
style={just=l font_weight=bold};
line Region $25.;
ods _all_ close;
Not applicable
Posts: 0

Re: ODS RTF v DDE output file size

Posted in reply to Cynthia_sas
Hi Cynthia,

Thanks for your replay.

We are using the following code to specity the page x of y text:

%if &maxpg ne %then title%eval(&i+1) height=&tfsize j=c "&tmp. ({Page \field {\*\fldinst PAGE \\*MERGEFORMAT}} {of %trim(%left(&maxpg.))})";

where maxpg is the maximum page number as derived in our program, we do this because if we use the notation you have detailed below word open the document but the pagings says page 1 or 1, page 2 of 1, page 3, of 2 etc.. until it has manged to work out the maximum number of pages for itself.

Using the footnote statement to produce the line creates a line which spans the entire document where as usign the template code creates a solid line at the bottome of each table, I guess it a matter of presentation.

Posts: 9,365

Re: ODS RTF v DDE output file size

Posted in reply to deleted_user
Hi, Pauline:
I understand now what you're doing. I've seen the page 1 of 1, page 2 of 1 issue...mostly in earlier version of Word...97 and 2000. I don't think I've seen it in Office 2007, but I'll pay attention the next time I open an RTF file there to see whether it happens.

That still doesn't help you with your file size issue, however. If you had SAS 9 and could switch to ODS PDF, then you'd probably have the best of both X of Y numbering that didn't change when the file opened and COMPRESS options as well.

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