The SAS Output Delivery System and reporting techniques

ODS HTML and Paging Reports

Reply
N/A
Posts: 0

ODS HTML and Paging Reports

Hi,

I have a report that I have written and at the end of the report I need to put another table. I use proc report for the main report and then another proc report for the final table. In the PDF version of the report the 2 proc reports appear on the same page, but in the HTML version the proc report appear on separate pages (Have there own titles and footnotes). My question is; how can I stop the proc reports from appearing on different pages on the HTML version.

Regards,
Dave
SAS Super FREQ
Posts: 8,868

Re: ODS HTML and Paging Reports

Posted in reply to deleted_user
Hi:
In the normal mode of operation, every procedure starts a new page in a "paged" destination like RTF or PDF. HTML, of course, isn't a "paged" destination. Generally, the only indication in an HTML file of where a page break -would- occur is in the horizontal rule that will separate tables.

In order for your 2 separate PROC REPORTs to appear on the same page in the PDF output, I suspect that you have STARTPAGE=NO in your code someplace.

Most style templates have an instruction, called "pagebreakhtml" in the style template, which attaches a CSS style property to the horizontal rule (page-break-after:always). If your browser supports this level of CSS, it is possible that when you print the HTML file using the browser, that each report output would appear on a separate page. (This note further describes the page break behavior with HTML: http://support.sas.com/rnd/base/ods/templateFAQ/Template_csstyle.html#pb)

ODS HTML doesn't have a "startpage" option, so in order to suppress the default page-breaking behavior, you might try to follow these guidelines from Tech Support:
http://support.sas.com/kb/23/460.html
http://support.sas.com/kb/23/630.html

or switch to a style like Minimal which only uses <hr>.

cynthia
N/A
Posts: 0

Re: ODS HTML and Paging Reports

Posted in reply to Cynthia_sas
Hi Cynthia,

Thanks for the reply. Is there anyway to do this on the fly to change the behavior of individual proc reports. For example - I need 2 proc reports on one "page", but when I start a 3rd proc report I want it to start on a new page?

Regards,
Dave Boleyn
SAS Super FREQ
Posts: 8,868

Re: ODS HTML and Paging Reports

Posted in reply to deleted_user
Hi:
I guess it really depends on the destination. For RTF and PDF, yes. For HTML, since HTML doesn't really have paging, I don't know what you mean when you say you want the report to start on a new "page".

For RTF and PDF, the STARTPAGE= option has syntax (STARTPAGE=NO, STARTPAGE=NOW and STARTPAGE=YES) that would allow you to suppress and start page breaking as you desired.

For HTML, once you create the HTML file, SAS is out of the picture. All printing is done by the browser/printer interface. While you could turn off the horizontal rule in HTML that appears between procedures, ALL procedures; there's no "on the fly" insertion of page breaks (such as STARTPAGE=NOW, etc) because HTML doesn't support the STARTPAGE= option and because HTML doesn't really have "paging". The closest that HTML comes to the idea of a page break is to use CSS style properties, which "suggest" a place for a compliant browser/printer to put a page break when the HTML output is printed. However, if the browser does not support the CSS spec, then the "suggestion" that SAS puts in the file is ignored.

So again, to guarantee the structure you want, page-wise, my suggestion is to look at ODS PDF or ODS RTF and the STARTPAGE= option.

cynthia
N/A
Posts: 0

Re: ODS HTML and Paging Reports

Posted in reply to Cynthia_sas
Hi Cynthia,

Sorry if I was not being clear. The PDF version of the report is fine. What I want to do is control the title, footer and horizontal rule in HTML so that when I want multiple proc report outputs grouped together with a title at the top and a footer at the bottom I can. So what I am asking is can I change the style definition (e.g. pagebreakhtml) midway through an ODS HTML to achieve this behaviour.

Regards,
Dave Boleyn
SAS Super FREQ
Posts: 8,868

Re: ODS HTML and Paging Reports

Posted in reply to deleted_user
Hi:
Well, sort of. What you CAN do is use a style template that does not have the horizontal rule at all (like SEASIDE or NORMAL). Then you can selectively insert a horizontal rule where you want.

Let's talk terminology for a minute. SAS has TITLE and FOOTNOTE statements -- a TITLE goes at top of a particular table, a FOOTNOTE goes at the bottom of a table. HTML does not have the concept of "page" headers and footers. Microsoft Word has HEADERS and FOOTERS -- information that is repeated on every page. so when you say you want Titles and Footers, I hope that was a typo and you want to control the TITLE and FOOTNOTE. HTML does not have the concept of "headers" and "footers" like Microsoft Word.

So if you consider this code, then what it produces are 3 tables (I just used PROC PRINT because it was quick) with titles and footnotes for each table. Note that there is NO horizontal rule between the tables.
[pre]
ods listing close;

ods html file='c:\temp\testhr1.html'
style=seaside;

proc print data=sashelp.class(obs=3);
title 'Title: SASHELP.CLASS';
footnote 'Footnote: At the end of Proc Print';
run;

proc print data=sashelp.retail(obs=3);
title 'Title: SASHELP.RETAIL';
footnote 'Footnote: Retail data';
run;

proc means data=sashelp.shoes min mean max;
title 'Title: SASHELP.SHOES';
footnote 'Footnote: This is the End';
var sales;
class region;
run;
ods html close;
[/pre]

Then, you could alter how this looks by selectively using TITLE and FOOTNOTE statements with the <HR> tags in the footnotes where you want them. Something like this:
[pre]
title; footnote;
ods html file='c:\temp\testhr_infoot.html'
style=styles.seaside;

proc print data=sashelp.class(obs=3);
title 'Title: SASHELP.CLASS';
run;
title;

proc print data=sashelp.retail(obs=3);
footnote 'Footnote: At the end of 2nd Proc Print';
footnote2 '
';
run;


proc means data=sashelp.shoes min mean max;
title 'Title: SASHELP.SHOES';
footnote 'Footnote: This is the End';
footnote2 '
';
var sales;
class region;
run;
ods html close;
title; footnote;
[/pre]

There's probably a 2nd way to do it with ODS HTML TEXT= and a style template, but this seemed the simplest thing to try first.

cynthia
Ask a Question
Discussion stats
  • 5 replies
  • 719 views
  • 0 likes
  • 2 in conversation