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;
Hi:
Here's an example that shows 2 different uses of the TITLE statement with a logo:
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
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.
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
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?
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
Hi:
Here's an example that shows 2 different uses of the TITLE statement with a logo:
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
This worked! Thank you so much Cynthia! 🙂
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.