BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nnat
Calcite | Level 5

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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. 

nnat
Calcite | Level 5

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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?

Cynthia_sas
SAS Super FREQ

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

Cynthia_sas
SAS Super FREQ

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

nnat
Calcite | Level 5

This worked! Thank you so much Cynthia! 🙂

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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