Usage Note 24190: Why can't I read my CSS files created with SAS Enterprise Guide in Base SAS with ODS HTML?
This document helps you fix two possible problems that prevent Base SAS from successfully reading a CSS file that was created in Enterprise Guide.
If you have black and white output after pointing to your CSS file with the STYLESHEET= option with the URL= sub-option and your path has spaces, then take a look at SAS Note 13869. This discusses the new behavior with the STYLESHEET=
option.
If your CSS file loads successfully and the CSS file contains a banner/image, it will not display. Both SAS Enterprise Guide and Base SAS use the same class names with one exception: a class name that is unique to SAS Enterprise Guide, the .EGBanner class selector. This class selector is responsible for loading the banner that is located on the center top of the page. Base SAS does not map this Enterprise Guide class selector to any part of the output. So, once you have successfully been able to link to this CSS file, the image is not loaded because Base SAS and ODS do not know about this .EGbanner class selector. What Enterprise Guide does is to use JavaScript to dynamically insert an image tag with the path of the image defined with the .EGBanner class selector. With the use of DHTML and JavaScript, we get the path of the class selector with the name .EGBanner and strip off the URL( ) and the parentheses.
The document.body.insertAdjacentHTML DHTML command is then used to insert an image tag with the banner .EGBanner class in the CSS file. Here are several ways to add this banner using ODS in Base SAS:
- You can add the image with PROC TEMPLATE using the PRETEXT= attribute
with the appropriate image. This requires that you redefine the image.
proc template;
define style styles.test;
parent=styles.default;
style body from body /
pretext='<div style="text-align:center">
<img src="c:\logo.jpg"></div>';
end;
run;
ods html file="temp.html" style=styles.test
stylesheet=(url="c:\egdefualt.css");
proc print data=sashelp.class;
run;
ods html close;
- The image can also be added to the header of the HTML file using the
HEADTEXT= option:
ods html file="temp.html"
headtext='<div style="text-align:center">
<img src="c:\logo.jpg"></div>';
proc print data=sashelp.class;
run;
ods html close;
- The JavaScript function that is used in Enterpise Guide can be added
with PROC TEMPLATE to the Body style element. This inserts the <img>
tag before the body. You can specify the name of the function to call in the
StartupFunction style element which loads this when the page is loaded. This
prevents you from having to redefine the logo. See the JavaScript file.
proc template;
define style styles.test;
parent=styles.default;
Replace StartupFunction /
tagattr="LoadBanner()";
style body from body /
posthtml='<SCRIPT LANGUAGE=JAVASCRIPT
TYPE="text/javascript" SRC="C:\egjscript.JS">
</script>';
end;
run;
ods html path='c:\'(url=none) style=styles.test
stylesheet=(url="c:\egdefault.css");
proc print data=sashelp.class;
title;
run;
ods html close;
- Use the below tagset which includes the JavaScript code and function call.
You can use this when you want to use the EGDEFAULT style. This specific
tagset works with SAS 9.1 and can be modified to work with SAS 8.2. This
tagset loads the function LoadBanner which is defined in the event Doc. As
mentioned earlier, if an image is defined with the .EGbanner class this will
create an image tag and insert the path to the image tag dynamically within
the HTML. See the SAS code.
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | low |
Topic: | Query and Reporting ==> Creating Reports ==> Stylesheets SAS Reference ==> ODS (Output Delivery System)
|
Date Modified: | 2005-05-06 16:13:58 |
Date Created: | 2004-11-02 13:08:51 |