I am using PROC REPORT to generate tables, and sending the output to an HTML file via ODS HTML. Everything works great, I get the exact tables that I want, except I want two tables on a page, and there are more than 2 BY groups. So, I want the first two BY groups on page 1, the next two BY groups on page 2, and so on and so forth. For completeness, here is my code (although I think the problem isn't this code, it's somewhere in ODS that I don't know). How can I do this?
ods html file="report.html" path="&myfolder" style=htmlblue;
proc report nowindows data=stats1; by fico; column ias ltv,ever60pct ltv,bankinterestrate ltv,nloans; define ias/group 'IAS' order=data; define ltv/across "LTV" order=internal; define ever60pct/analysis sum format=nlpctn12.2 'Ever 60 %'; define nloans/analysis sum format=comma6.0 'N Loans'; define bankinterestrate/analysis sum format=6.2 'Interest Rate'; run;
ods html close;
HTML doesn't have a concept of pages - that's likely the biggest issue.
Can you provide some example data. I'm not going to try to fudge something up with that many variables.
How about this one ? ods html options(page_break='no'); proc report data=sashelp.class(where=(sex='F')) nowd; run; ods text='
'; proc report data=sashelp.class(where=(sex='M')) nowd; run; ods text='
'; proc report data=sashelp.class nowd; run; ods html close;
Thanks, @Ksharp. I will give this a try on Monday.
This raises the question, if ODS HTML is not a good choice here (as pointed out by @Reeza), what would be a better ODS destination where I can force a new page after two by groups, and another new page after another two by groups, and so on?
PDF or RTF and use STARTPAGE option to control page breaks?
@Reeza wrote:
PDF or RTF and use STARTPAGE option to control page breaks?
I will certainly give this a try on Monday when I am back in the office. It appears that I am going to have to write some sort of macro loop to output two by-groups at a time to a single page (which, by the way, is not the problem, I can write macro loops in my sleep). Do you agree? Or am I missing something here?
@PaigeMiller wrote:
@Reeza wrote:
PDF or RTF and use STARTPAGE option to control page breaks?
I will certainly give this a try on Monday when I am back in the office. It appears that I am going to have to write some sort of macro loop to output two by-groups at a time to a single page (which, by the way, is not the problem, I can write macro loops in my sleep). Do you agree? Or am I missing something here?
Proc Report does have a role for a variable to do "page" so if an additional variable to indicate the page as the first column and set to noprint might work.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.