The SAS Output Delivery System and reporting techniques

PROC REPORT : Create multiple tables using multiple proc reports and combine them into one HTML/PDF/

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

PROC REPORT : Create multiple tables using multiple proc reports and combine them into one HTML/PDF/

[ Edited ]

Hello,

 

I am trying to create a report using the following code:

 

/*--------------Final Report--------------*/
ods html file="MONTHLY_SNAPSHOT.htm" style=festival ;
options label ;
title1 'MONTHLY EXECUTIVE SNAPSHOT';
footnote1 ' ';

/*----Total Balance by Program----*/

proc report data=bal missing nowd headskip split="~" spanrows 

	style(report)=[background=white cellspacing=1  borderwidth=2 bordercolor=blue   ]

	style(header)=[color=Black
	fontsize=2]

	style(column)=[color=Black fontfamily=helvetica fontsize=1.8];
	
	title2 'Total Balance by Program';
	column Product Balance,RECORD_DATE;
	define product / group "Product"    style(header)=[textalign=r] style(column)=[fontsize = 2 textalign=r cellwidth=0.75in] ;
	define RECORD_DATE / across order=data 'Month';
	define balance / analysis '' style=[fontsize = 2];
	rbreak after /summarize style=[fontweight=bold fontsize = 2];

	compute after;
		product='Total';
	endcomp;

	
run;

/*----Total No. of Loans by Program----*/

proc report data=LOANS missing nowd headskip split="~" spanrows

	style(report)=[background=white cellspacing=1  borderwidth=2 bordercolor=blue   ]

	style(header)=[color=Black
	fontsize=2]

	style(column)=[color=Black
	fontfamily=helvetica fontsize=1.8];
	title1 'Total # Loans by Program';
	column Product '#'n,RECORD_DATE;
	define product / group "Product"    style(header)=[textalign=r] style(column)=[fontsize = 2 textalign=r cellwidth=0.75in];
	define RECORD_DATE / across order=data 'Month';
	define '#'n / analysis '' style=[fontsize = 2];
	rbreak after /summarize style=[fontweight=bold fontsize = 2];

	compute after;
		product='Total';
	endcomp;

	footnote1 ' ';
run;

/*----Monthly Originations by Program----*/

proc report data=Originations missing nowd headskip split="~" spanrows

	style(report)=[background=white cellspacing=1  borderwidth=2 bordercolor=blue   ]

	style(header)=[color=Black
	fontsize=2]

	style(column)=[color=Black
	fontfamily=helvetica fontsize=1.8];
	title1 'Monthly Originations by Program';
	column Product Originations,RECORD_DATE;
	define product / group "Product"    style(header)=[textalign=r] style(column)=[fontsize = 2 textalign=r cellwidth=0.75in] ;
	define RECORD_DATE / across order=data 'Month';
	define originations / analysis '' style=[fontsize = 2];
	rbreak after /summarize style=[fontweight=bold fontsize = 2];

	compute after;
		product='Total';
	endcomp;

	footnote1 ' ';
run;

/*----Monthly # Loan by Program----*/

proc report data=NumOriginations missing nowd headskip split="~" spanrows

	style(report)=[background=white cellspacing=1  borderwidth=2 bordercolor=blue   ]

	style(header)=[color=Black
	fontsize=2]

	style(column)=[color=Black
	fontfamily=helvetica fontsize=1.8];
	title1 'Monthly # Loan Originations by Program';
	column Product '#'n,RECORD_DATE;
	define product / group "Product"    style(header)=[textalign=r] style(column)=[fontsize = 2 textalign=r cellwidth=0.75in] ;
	define RECORD_DATE / across order=data 'Month';
	define '#'n / analysis '' style=[fontsize = 2];
	rbreak after /summarize style=[fontweight=bold fontsize = 2];

	compute after;
		product='Total';
	endcomp;

	footnote1 'COMPANY NAME';
	FOOTNOTE2 "Generated by SAS on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
run;

ods pdf close;
ods listing;

Some issues I am unable to tackle:

 

1. As can be seen, i have 4 different proct reports and those get combined into a single htm. How can I do it more efficiently because there is too much space between the 4 tables in the final output

 

2. The titles & footnotes - Trying to get a single global title and 4 individual titles before each table AND only *one* global footnote (no individual footnotes). Hance the footnote1'   ' ;   after every proc report (*sigh*).

 

Any help is appreciated.

 

Thanks


Accepted Solutions
Solution
‎06-08-2016 04:51 PM
Grand Advisor
Posts: 10,251

Re: PROC REPORT : How to create more than one tables that use different data sets in one proc report

Proc report will not use two or more datasets.

 

I'm pretty sure you are leaving something out as I see and ODS HTML destination opened but the ODS PDF Close.

 

If you need text that doesn't work with Titles you might try either ODS TEXT, which with ESCAPECHAR can modify style elements such as font, font size, font weight, font color and a host other things with enough work. Similar with footnotes. I believe that footnotes work a bit differently with other destinations. Since HTML doesn't really have a concept of page you may get more footnotes than wanted. Would RTF or PDF work instead of HTML?

 

Or you may be able to use Style Pretext and PostText elements.

 

Space between procedure output depends on a number of things, active style, font and some other stuff depending on destination.

 

 

View solution in original post


All Replies
Solution
‎06-08-2016 04:51 PM
Grand Advisor
Posts: 10,251

Re: PROC REPORT : How to create more than one tables that use different data sets in one proc report

Proc report will not use two or more datasets.

 

I'm pretty sure you are leaving something out as I see and ODS HTML destination opened but the ODS PDF Close.

 

If you need text that doesn't work with Titles you might try either ODS TEXT, which with ESCAPECHAR can modify style elements such as font, font size, font weight, font color and a host other things with enough work. Similar with footnotes. I believe that footnotes work a bit differently with other destinations. Since HTML doesn't really have a concept of page you may get more footnotes than wanted. Would RTF or PDF work instead of HTML?

 

Or you may be able to use Style Pretext and PostText elements.

 

Space between procedure output depends on a number of things, active style, font and some other stuff depending on destination.

 

 

New Contributor
Posts: 3

Re: PROC REPORT : How to create more than one tables that use different data sets in one proc report

@ballardw - Thanks!

 

I'm using ODS TEXT and changed it to PDF. 

 

Much better now.

 

 

 

 

 

 

 

 

 

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 844 views
  • 0 likes
  • 2 in conversation