The SAS Output Delivery System and reporting techniques

ods header image with title statement and subsequent title statements

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

ods header image with title statement and subsequent title statements

[ Edited ]

Hi, I'm trying to create an ODS pdf report using multiple proc prints/proc reports, and I need to add a header image to all pages of the pdf.  A small snippet of the code is below.  I know my header image isn't showing up because the title statements in the disclaimer and overview chunks are overwriting the initial title statement with the .png file.  If I comment out the title statements within the proc prints, the header image does appear in the pdf output.  Is there a way to work around this? How can I keep the subsequent titles for my final pdf report?

 

 

ods pdf file = "C:\test\report.pdf" nogtitle nogfootnote;
ods escapechar='~';
title j=r "~S={preimage='C:\test\header_image.png'}";

/*disclaimer*/
proc import datafile = "C:\test\disclaimer.xlsx" out=disclaimer dbms=xlsx replace;
run;

proc print data=disclaimer noobs;
title 'Disclaimer';
run;

/*overview*/
proc import datafile = "C:\test\overview.xlsx" out=overview dbms=xlsx replace;
run;

proc print data=overview noobs label;
title 'Overview';
run;

ods pdf close;

 


Accepted Solutions
Solution
‎04-17-2018 10:54 AM
SAS Super FREQ
Posts: 9,425

Re: ods header image with title statement and subsequent title statements

Posted in reply to Cynthia_sas

Hi:

  Here's an example that shows 2 different uses of the TITLE statement with a logo:

show_logo.png

 

 

 

As you can see #1 example uses the string Disclaimer and the logo on 1 TITLE statement and the #2 example uses a TITLE statement for the logo and a TITLE2 statement for the string Overview.

 

Hope this helps,

 

Cynthia

View solution in original post


All Replies
Super User
Super User
Posts: 9,829

Re: ods header image with title statement and subsequent title statements

Not sure I am really following, proc output doesn't overwrite titles and footnotes in the output normally, it would normally page break before that happened.  I also quesiton why you have: 

nogtitle nogfootnote

These are for graphs, and tell SAS to not put graph titles in the image.  Maybe try without that option.  Also showing what you mean, by and image, may also help. 

Occasional Contributor
Posts: 8

Re: ods header image with title statement and subsequent title statements

apologies if I was unclear, above is just a small snippet of the program I am also using proc gplot to print some graphs which is why I have nogtitle and nogfootnote

Super User
Super User
Posts: 9,829

Re: ods header image with title statement and subsequent title statements

I would suggest then, that you create various PDF files of each of your outputs, and then PDF combine them later.  Never had any joy with document creation in SAS, hence why we always create a separate output for each block, then Combine Files In Adobe from Windows explorer.  Options for instance tend to be global and affect all the outputs for instance, which may lead to untoward effects.  Anyways, can you post a screenshot of what is actually happening, sounds like page breaking is not working?

SAS Super FREQ
Posts: 9,425

Re: ods header image with title statement and subsequent title statements

[ Edited ]

Hi, Well your first TITLE statement is being overwritten by the TITLE statement in the PROC PRINT. What happens if you make the PROC PRINT TITLE2 instead of TITLE?? OR, consider doing this:
PROC PRINT #1:
title j=r "~S={preimage='C:\test\header_image.png'}" j=c "Disclaimer";

PROC PRINT #2
title j=r "~S={preimage='C:\test\header_image.png'}" j=c "Overview";

Take a look at this previous posting. https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-Left-justify-image-and-center-text-in-... It is not exactly the same as your example, but shows other uses of ESCAPECHAR with TITLEs.

cynthia

Solution
‎04-17-2018 10:54 AM
SAS Super FREQ
Posts: 9,425

Re: ods header image with title statement and subsequent title statements

Posted in reply to Cynthia_sas

Hi:

  Here's an example that shows 2 different uses of the TITLE statement with a logo:

show_logo.png

 

 

 

As you can see #1 example uses the string Disclaimer and the logo on 1 TITLE statement and the #2 example uses a TITLE statement for the logo and a TITLE2 statement for the string Overview.

 

Hope this helps,

 

Cynthia

Occasional Contributor
Posts: 8

Re: ods header image with title statement and subsequent title statements

Posted in reply to Cynthia_sas

This worked! Thank you so much Cynthia! Smiley Happy

☑ This topic is solved.

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

Discussion stats
  • 6 replies
  • 170 views
  • 1 like
  • 3 in conversation