BookmarkSubscribeRSS Feed
Siddhartha
Calcite | Level 5
I want to add two company logos, one at Upper Left corner and other at Upper Right corner above the title statement and I am using proc report.
It's a html output.
Can anyone help me on this.

Regards,
Siddhartha
5 REPLIES 5
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
So, what SAS code have you tried...if any? The best approach is to share your code, preferably in a SAS-generated log with all code revealed.

Scott Barry
SBBWorks, Inc.
ArtC
Rhodochrosite | Level 12
One potential REPORT solution is to use the PREIMAGE and/or POSTIMAGE attributes in the STYLE override option. You will have something like the following:
[pre] compute before _page_ /
style={preimage="c:\temp\ATT00001.jpg"
just=left
font_weight=bold
font_face=arial
font_size=6};
line 'ABC, Inc.';
line 'Sales Summary';[/pre]

Here it is placed in the COMPUTE BEFORE statement.
Cynthia_sas
SAS Super FREQ
For the PROC REPORT example, remember that a SAS Title would be above the images from COMPUTE BEFORE _PAGE_, so you'd have to take this into account when coding.. If the desire is for the logos or images to be in the vicinity of the very top of the page area reserved for titles, no matter what procedure was used, then another approach is necessary.

But using "preimage" as one of the search terms, should give the original poster enough to go on to find the many examples of inserting an image into ODS output that are available in previous forum postings and on support.sas.com in Tech Support notes.

And... using an "absolute" location like "c:\temp\ATT00001.jpg" for HTML image insertion, might not produce the desired results, especially if the HTML file is moved to a web server that does not have a C drive (such as a UNIX web server).

The bottom line is that the original poster said he was interested in ODS HTML, but did not share his code so we could see whether he was using TITLE statements, whether he was using ODS HTML or ODS MSOFFICE2K or ODS PHTML. He did not indicate whether he was using CSS files with his HTML output or whether he was using a custom style template or one of the SAS default templates -- all of which we would have been able to find out if some code had been shared.

Depending on what he wants to do, there are at least 3 other ways to put images into HTML output:
1) If he is using CSS technology with HTML, alter the CSS file to include image references for display in the HTML output;
2) If he is using style templates, alter the style template to refer to an image for display in the HTML output;
3) use ODS ESCAPECHAR and insert the image reference directly in a SAS Title statement.

There have been many examples of #3 in previous forum postings; I know that there are examples of #2 in Tech Support notes and the ODS FAQ; examples of #1 can be found in any CSS reference guide.

cynthia
Ksharp
Super User
I try the this two method.It is very interesting.

[pre]
ods pdf file="c:\temp\main.pdf" style=sasweb;
ods escapechar='~';
options nodate nonumber;
title j=left "~S={preimage='c:\temp\brand.gif'}" j=right "~S={postimage='c:\temp\merlin.gif'}";
title4 j=center "CBRC Company" ;
proc report data=sashelp.class nowd;
column name sex height weight;
define name /display;
compute before _page_ / style={preimage='c:\temp\brand.gif' postimage='c:\temp\merlin.gif'};
line 'CBRC company';
line 'whatever you want';
line 'find everything';
endcomp;
run;
ods pdf close;
[/pre]


But when I open main.html from 'c:\temp\' ,the image is disappear,Why does it appear?

Ksharp
Cynthia_sas
SAS Super FREQ
But your code creates a PDF file, not an HTML file. And remember that for a COMPUTE block, such as COMPUTE BEFORE _PAGE_ preimage will be BEFORE the LINE output and postimage should be AFTER the LINE output - what I can't remember is whether the POSTIMAGE will get placed after the first LINE or after all the LINES. But anyway, the images will be within the footprint of the table -- so if you have a skinny table, the images will NOT look like they are logos at the top of the HTML page.

So I do not think that COMPUTE BEFORE _PAGE_ is actually what the original poster wants -- but I'm just guessing, since the OP has never come back to contribute to this on-going conversation.

As to why your images did not show, if you did indeed use ODS HTML, then there are several reasons why you might not have seen the images in the output. You may not have used PATH= correctly, the HTML output might not have been placed in the c:\temp directory, the <IMG> tag that was built for the image was incorrect. Since you posted PDF code, it is hard to comment.

This Tech Support note shows how to use PREIMAGE in a style template:
http://support.sas.com/kb/23/385.html

and this user-group paper:
http://www2.sas.com/proceedings/forum2007/099-2007.pdf (on page 14) shows how to use ODS ESCAPECHAR (for RTF, PDF and HTML).

These FAQ and Tech Support notes all have examples of using images:
http://support.sas.com/kb/23/485.html (shows direct HTML method)
http://support.sas.com/kb/23/419.html
http://support.sas.com/kb/23/691.html

This code, without the COMPUTE BEFORE _PAGE_ worked for me using ODS HTML to get 2 images into a SAS TITLE statement.

cynthia
[pre]
** note, all images are stored in c:\temp directory;
** use relative path name for IMG tag;
ods html path='c:\temp' (url=none)
file="main.html" style=sasweb;
ods escapechar='~';

title j=left "~S={preimage='image1.jpg'}" j=c 'CBRC Company' j=right "~S={preimage='image2.jpg'}";
title2 j=center "Title Line 2" ;
proc report data=sashelp.class nowd;
column name sex height weight;
run;
ods html close;
[/pre]

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 1365 views
  • 0 likes
  • 5 in conversation