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

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;

jlee8_0-1603046989017.png

 


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;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi,

Here's an example of what Jos describes:

Cynthia_sas_0-1603113368518.png

 

It may not work in EG until you take "full control" by using explicit ODS statements.

 

Cynthia

View solution in original post

6 REPLIES 6
JosvanderVelden
SAS Super FREQ
Are you writing the output to an html-file by specifying it in an ods statement?
It should work if you write to a file using something like: ODS HTML FILE="test.html";

Best regards, Jos
Cynthia_sas
SAS Super FREQ

Hi,

Here's an example of what Jos describes:

Cynthia_sas_0-1603113368518.png

 

It may not work in EG until you take "full control" by using explicit ODS statements.

 

Cynthia

jlee8
Fluorite | Level 6
Thanks for the kind explanation!
jlee8
Fluorite | Level 6
Thank you for your answer!
jlee8
Fluorite | Level 6

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"};

 

PROCREPORT.PNG

Cynthia_sas
SAS Super FREQ

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.

Cynthia_sas_0-1603232019744.png

 

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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4507 views
  • 3 likes
  • 3 in conversation