Hi all,
I have been trying to add an image to my pdf report in SAS EG but not been successful. Even when I run the following code which is a sample code for inserting an image, the image does not load and shows only a paper icon with an X on it.
proc report data=sashelp.class(obs=3) nowd
style(report)=
{preimage="http://www.sas.com/images/logos/SAS_TPTK_logo.gif"};
title 'Use URL for PREIMAGE';
Does anyone know what the issue is here?
Thank you very much!
JLee
run;
ods html close;
proc report data=sashelp.class(obs=3) nowd
style(report)=
{preimage="X:\Local\Folder\LOGO.png"};
title 'Use local file for PREIMAGE';
run;
ods html close;
Hi,
Here's an example of what Jos describes:
It may not work in EG until you take "full control" by using explicit ODS statements.
Cynthia
Hi,
Here's an example of what Jos describes:
It may not work in EG until you take "full control" by using explicit ODS statements.
Cynthia
I have the following code and the attached result. The problems I have with the pdf output is that
1) the image seems to be part of the table. Is there a way to place the image, let's say, at the top left corner of the page just once instead?
2) The title for the first report gets overwritten by the second one. How can I have a title on top of each of the tables, not just once at the top of everything.
Thank you in advance for looking into this. Your help is much appreciated.
JL
ods pdf file= '/sasdata/myfolder/tst2.pdf' Startpage = no;
options nodate nonumber;
title 'REPORT ONE';
proc report data=sashelp.class(obs=3) nowd
style(report)=
{preimage="http://www.sas.com/images/logos/SAS_TPTK_logo.gif"};
title 'REPORT TWO';
proc report data=sashelp.class(obs=3) nowd
style(report)=
{preimage="http://www.sas.com/images/logos/SAS_TPTK_logo.gif"};
Hi: When you made your original posting, you did not mention that you needed a PDF document. The issue with the image being part of the table is that PROC REPORT is working as designed. When you put the image reference in a style(report) override with the preimage attribute, as you show, whether HTML, RTF or PDF, the image is going to be inserted at the top of the report, under the title and INSIDE the boundary of the report table.
If you do not want the image to be inside the boundary of the table, then you need to move the preimage override into the SAS title statement (option 1 -- easiest to control or change the style template for your destination (harder to control and turn off).
I think this is what you're describing.
Note that I did put page numbers in just so you could see the title at the top of the 2nd page does NOT have the image. But that needed to have a separate title statement without a reference to the logo.
Also, with ODS PDF, the title on your 2nd PROC REPORT will not show. As far as ODS PDF is concerned, titles go at the top of the page, footnotes at the bottom and there is no such thing as a title for the 2nd report when you use STARTPAGE=NO, because, by default, the 2nd report on a page is not at the top of the page where there's a header/title area. That's why I used COMPUTE BEFORE _PAGE_ for report #2 on page 1.
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.