BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Barkat
Pyrite | Level 9

I need to create a 4-pages PDF report. Page-1: Title and intro para; page-2: two charts with titles and notes; page-3: one table with titles and notes; page-4: two tables with titles and notes. A footnote at the bottom of last three pages. Also, page number and Sysdate at the bottom of each page. I have been struggling for more than 4 months for managing page breaks, the notes, footnotes, and titles. Is there any way to share the whole SAS program with someone and seek help?

1 ACCEPTED SOLUTION

Accepted Solutions
Barkat
Pyrite | Level 9

I was helped by a SAS certified Advanced Programmer from SAS technical support team for this problem.

 

They suggested the following

use ODS ESCAPECHAR= '^';   before ODS PDF FILE ='C:\.....    '; statement.

 

use ODS PDF STARTPAGE=NOW; at the place where I want to start a page.

 

Since the subsequent title is not displayed when there is more than one graphs or tables in one page, I will need to use ODS PDF TEXT= "^S={font_size= 20pt just=center fontweight=Bold}Title of tables or figures";   statements for the title of the subsequent graphs or tables.

View solution in original post

4 REPLIES 4
ballardw
Super User

Have you looked at Proc Document at all? That is a tool for combining output from multiple procedures, such as Proc Report or the graphing procedures and then assembling the completed pieces.

 

You could post the program you have here. Best is to place in a text box or code box opened with the </> or "running man" icons.

 

If you do post code then perhaps some example data would be a good idea as well.

Barkat
Pyrite | Level 9

Here is a SAS program for example. I would like to print a PDF of four pages.

Page-1 will contain report titles and intro paras.

Page-2 will contain two figures with their titles

page-3 will contain table-1 with title

page-4 will contain table-2, and -3 with their titles

All pages will have footer.

data Title1;
   Text="SAS Help Cars report";
   output;
run;

data Title3;
   Text="All cars";
   output;
run;
data Title4;
   Text="&SYSDATE9";
   output;
run;
data Title5;
   Text="Bextran Road Transport authority";
   output;
run;
data Intro1;
   Text="Blah blah blah Blah blah blah Blah blah blah Blah blah blahBlah blah blah Blah blah blah
Blah blah blah Blah blah blah Blah blah blah Blah blah blah 
Blah blah blahBlah blah blahBlah blah blah Blah blah blah Blah blah blah";
   output;
run;
data Intro2;
   Text="Blah blah blah Blah blah blah Blah blah blah Blah blah blahBlah blah blah Blah blah blah
Blah blah blah Blah blah blah Blah blah blah Blah blah blah 
Blah blah blahBlah blah blahBlah blah blah Blah blah blah Blah blah blah
Blah blah blah Blah blah blah Blah blah blah Blah blah blahBlah blah blah Blah blah blah
Blah blah blah Blah blah blah Blah blah blah Blah blah blah 
Blah blah blahBlah blah blahBlah blah blah Blah blah blah Blah blah blah
Blah blah blah Blah blah blah Blah blah blah Blah blah blahBlah blah blah Blah blah blah
Blah blah blah Blah blah blah Blah blah blah Blah blah blah 
Blah blah blahBlah blah blahBlah blah blah Blah blah blah Blah blah blah
Blah blah blah Blah blah blah Blah blah blah Blah blah blahBlah blah blah Blah blah blah
Blah blah blah Blah blah blah Blah blah blah Blah blah blah 
Blah blah blahBlah blah blahBlah blah blah Blah blah blah Blah blah blah
";
   output;
run;


ods _all_ close;

ods pdf 
file="\\accounts..................pdf" 
notoc startpage=no NOGTITLE NOGFOOTNOTE ;
ODS Graphics / reset=all width=7.5in height=4in scale=on border=off imagefmt=png;
options  nodate number ;

footnote2 height=7pt justify=left "Blah blah blah blah";
footnote3 height=7pt justify=left "Blah blah blah blah";
footnote4 height=7pt justify=left "Blah blah blah blah";
footnote5 height=7pt justify=left "              ";
footnote6 height=8pt justify=left "Blah blah blah blah";
footnote7 height=8pt justify=right "&SYSDATE";

/*Start: Title and Introduction in the output*/
proc report data=title1 nowd noheader
     style(report)={outputwidth=72% rules=none frame=void} 
     style(column)={fontsize=18pt fontweight=Bold};
   column Text;
   define Text / style={just=c};
run;

proc report data=title3 nowd noheader
     style(report)={outputwidth=100% rules=none frame=void} 
     style(column)={fontsize=16pt fontweight=Bold};
   column Text;
   define Text / style={just=c};
run;
proc report data=title4 nowd noheader
     style(report)={outputwidth=100% rules=none frame=void} 
     style(column)={fontsize=14pt fontweight=Bold};
   column Text;
   define Text / style={just=c};
run;
proc report data=title5 nowd noheader
     style(report)={outputwidth=100% rules=none frame=void} 
     style(column)={fontsize=14pt fontweight=Bold};
   column Text;
   define Text / style={just=c};
run;
proc report data=Intro1 nowd noheader
     style(report)={outputwidth=100% rules=none frame=void} 
     style(column)={fontsize=8pt};
   column Text;
   define Text / style={just=l};
run;
proc report data=Intro2 nowd noheader
     style(report)={outputwidth=100% rules=none frame=void} 
     style(column)={fontsize=8pt};
   column Text;
   define Text / style={just=l};
run;

 title height=10pt justify=left "Fig 1: Blah blah blah blah";
proc sgplot data=sashelp.cars ;
    	series x=Type y=MSRP  /datalabel=MSRP lineattrs=( thickness=3 pattern=shortdash )  markers legendlabel="ASP" ;
  	series x=Type y=Invoice /datalabel=Invoice lineattrs=( thickness=3 pattern=longdash)  markers legendlabel="PVSP";
  format MSRP Invoice ;
  yaxis label='blah blah'
	LABELATTRS=(Family=Arial Size=10 Style=Italic Weight=Bold) 
	valueattrs=(Family=Arial color=gray size=10pt);
  xaxis valueattrs=(Family=Arial color=gray size=10pt)  
	display= (nolabel) NOTIMESPLIT VALUESROTATE= VERTICAL;
run;
title;

title height=10pt justify=left "Figure 2. blah blah blah blah";
proc sgplot data=sashelp.cars ;
    	series x=Type y=MSRP  /datalabel=MSRP lineattrs=( thickness=3 pattern=shortdash )  markers legendlabel="ASP" ;
  	series x=Type y=Invoice /datalabel=Invoice lineattrs=( thickness=3 pattern=longdash)  markers legendlabel="PVSP";
  format MSRP Invoice ;
  yaxis label='blah blah'
	LABELATTRS=(Family=Arial Size=10 Style=Italic Weight=Bold) 
	valueattrs=(Family=Arial color=gray size=10pt);
  xaxis valueattrs=(Family=Arial color=gray size=10pt)  
	display= (nolabel) NOTIMESPLIT VALUESROTATE= VERTICAL;
run;


title height=10pt justify=left "Table 1. table table table table";
proc report data=sashelp.cars; 
Where make in ("Honda" "Kia" "GMC");
column Make Model Type;
define Make / group "Make" ;
define Model / display "Model";
define Type / display "Type";
run;


title height=10pt justify=left "Table 2. table table table table";
proc report data=sashelp.cars; 
Where Make = "Honda";
column  Make Type;
define Make / group "Make";
define Type / display "Type";
run;


title height=10pt justify=left "Table 3. table table table kia" ;
proc report data=sashelp.cars; 
Where Make = "Kia";
column  Make Type;
define Make / group "Make";
define Type / display "Type";
run;
title;
footnote;

ods pdf close;
Barkat
Pyrite | Level 9
I have created example of such code from SASHELP.CARS data set and posted as you suggested.
Barkat
Pyrite | Level 9

I was helped by a SAS certified Advanced Programmer from SAS technical support team for this problem.

 

They suggested the following

use ODS ESCAPECHAR= '^';   before ODS PDF FILE ='C:\.....    '; statement.

 

use ODS PDF STARTPAGE=NOW; at the place where I want to start a page.

 

Since the subsequent title is not displayed when there is more than one graphs or tables in one page, I will need to use ODS PDF TEXT= "^S={font_size= 20pt just=center fontweight=Bold}Title of tables or figures";   statements for the title of the subsequent graphs or tables.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1366 views
  • 1 like
  • 2 in conversation