Including an image or banner file in stored process output


A common method to include custom image files or banner files in SAS stored process output is to use the "preimage" tag in the TITLE or FOOTNOTE of procedure output. Dependent upon the environment in which the stored process is executed, this preimage reference can be one of the following, in order of preference:

  1. unc path
  2. http address
  3. path to a directory and file on disk


The following code example shows these three methods to specify an image file at the top of a report:

*ProcessBody;
%stpbegin;
ods escapechar = "^";

title1  justify=center '^S={preimage="\\myserver\myimages\logo.jpg"}'; /* UNC path */
title2  justify=left   '^S={preimage="http://myserver:8080/logo.jpg"}'; /* URL */
title3  justify=right  '^S={preimage="c:\myimages\logo.jpg"}'; /* Path on disk */
proc print data=sashelp.class;
run;

%stpend;

However, dependent upon the client application (such as SAS® Enterprise Guide, Add-in for Microsoft Office, Stored Process Web Application, or SAS® Information Delivery Portal) and the output type produced by the stored process (such as HTML, PDF, or RTF), the image might not appear and an error message might occur. Accordingly, you should consider the following information when you specify a "preimage" tag in a SAS stored process:

  1. A UNC path that references a network shared directory is the most reliable method to display an image in stored process output across different client applications and output types. Use a UNC path for your image reference if you plan to distribute your stored processes on multiple client applications, or, if your users produce non-HTML output.
  2. A URL reference for the image file can only be used when the stored process produces HTML output. The following errors might occur if you specify a URL reference with other output types:

ERROR: Bad image http://web.server/logo.jpg: URLs are not supported in printer images;
default image will be used instead.
ERROR: A component of <BIConfigDir>\Lev1\SASMain\http:\\web.server\logo.jpg is not a directory.

3. A physical path on disk is the least reliable method for referencing an image file in stored process output. Although this method might work in some circumstances, the path might not be accessible from other systems and client applications.