The SAS Output Delivery System and reporting techniques

Adding Two Company Logos

Posts: 69

Adding Two Company Logos

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.

Super Contributor
Super Contributor
Posts: 3,174

Re: Adding Two Company Logos

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.
Valued Guide
Posts: 632

Re: Adding Two Company Logos

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_ /
line 'ABC, Inc.';
line 'Sales Summary';[/pre]

Here it is placed in the COMPUTE BEFORE statement.
Posts: 8,743

Re: Adding Two Company Logos

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 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.

Super User
Posts: 9,681

Re: Adding Two Company Logos

I try the this two method.It is very interesting.

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';
ods pdf close;

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

Posts: 8,743

Re: Adding Two Company Logos

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:

and this user-group paper: (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: (shows direct HTML method)

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

** 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;
ods html close;
Ask a Question
Discussion stats
  • 5 replies
  • 5 in conversation