The SAS Output Delivery System and reporting techniques

ODS html file change default style

Reply
N/A
Posts: 0

ODS html file change default style

Whenever I open the html file the style always returns to default even though I defined a different style. What methods can I do to change the default style?
SAS Super FREQ
Posts: 8,742

Re: ODS html file change default style

Hi:
I'm not sure what you mean by: "the style ALWAYS returns to the default"

Generally, SAS and ODS work with styles this way:
[pre]
ODS HTML file='wombat.html';
[/pre]

uses a gray and blue color scheme by default in most environments (this color scheme is called 'styles.default'. In an EG session, however, the color scheme defined by default is a cream and blue on a white background color scheme called 'styles.egdefault'. You do not have to do ANYTHING to get these default color schemes used.

If you WANT To change the color scheme/style, then you have 3 choices:
1) Use the STYLE= option to specify the "predefined" style template that you want to use (must be done EVERY time you run an ODS HTML step)
2) Create a SAS style template (with PROC TEMPLATE) and use that template name EVERY time in a STYLE= option
3) Use a Cascading Style Sheet (CSS) file with ODS HTML (must be done EVERY time)


1) use the SAS "pre-defined" styles EVERY TIME you run an ODS HTML step:
[pre]
ODS HTML file='wombat.html' style=sasweb;
ODS HTML file='koala.html' style=brick;
ODS HTML file='eucalyptus.html' style=statistical;
[/pre]

all of the above STYLE= option values are "predefined" style template definitions and they live in an item store called "SASHELP.TMPLMST" on your system.

2) if you want to define your OWN custom style template, then you have a slightly more complicated method...
[pre]
proc template;
define style styles.KERMIT;
....
end;
run;

ods html file='sesame.html' style=KERMIT;
[/pre]

By default, SAS will write the KERMIT style template into the first write-able item store on your system, which is usually SASUSER.TEMPLAT. So you only have to use the PROC TEMPLATE one time. BUT, you would have to use the style=KERMIT for EVERY output where you wanted the KERMIT style to be used:
So on the day after you ran your PROC TEMPLATE step, if you wanted to create a report using the KERMIT style, you'd have to do this:
[pre]
ods html file='muppet.html' style=KERMIT;
[/pre]

But, EVERY time you run an ODS HTML step, you have to explicitly specify a STYLE= option with the name of the style template you want to use...or else you get the default style again (either DEFAULT or EGDEFAULT).

And, there's an extra bump in the road if you did not use SASUSER.TEMPLAT as the location for your changed template. If you created a custom item store, then you will ALWAYS need to issue an ODS PATH statement to make that custom item store available to your SAS session (more about that below).

(I believe there may be a way to set a different default style inside EG but I can't remember the click path to do that. If that is your question, you might want to post it in the EG forum.)

...on to #3:
3) If you want to use CSS (Cascading Style Sheet) technology with your ODS HTML output and IF you already have a CSS file that you want to use, then you can do this -- let's say you have a corporate stylesheet that's been tailored to work with SAS output and SAS class selectors (called BigCorp.css):
[pre]
ods html path='c:\temp' (url=none) file='Use_Corp_Style.html'
stylesheet=(url='BigCorp.css');
OR
ods html path='c:\temp' (url=none) file='Use_Corp_Style.html'
stylesheet=(url="http://www.bigcorp.com/public/style/BigCorp.css");
OR

ods html path='c:\temp' (url=none) file='Use_Corp_Style.html'
stylesheet=(url="/style/BigCorp.css");
[/pre]

If you submit code similar to #1, without any STYLE= option, then you will ALWAYS get the default style of Gray and Blue for a SAS Display Manager session and the EG default style setting (usually EGDEFAULT) for the EG environment.

If you are running on the SAS Enterprise Intelligence Platform then there ARE other methods of specifying a default style to use, for example, when stored processes are run and results are returned to the Office client application. If you are having issues with the SAS Enterprise Intelligence Platform, then your best bet for help is to contact Tech Support.

One other possible problem is that you have ODS PATH problems ...in other words, you created a new style template definition...possibly like this:
[pre]
ods path sasuser.mytemp(update)
sashelp.tmplmst(read);
proc template;
...
run;
[/pre]

And for the duration of that session, your new style was available in sasuser.mytemp. However, everytime you log back onto SAS or onto a server, SAS "resets" the path for where to look for ODS templates. So by default, the search path is:
[pre]
ods path sasuser.templat(update)
sashelp.tmplmst(read); [/pre]

which means that IF your template is stored in SASUSER.MYTEMP, your session won't be able to find it and you would get the default used. If this is your situation, then you need to issue an explicit ODS PATH statement at the top of your code or in your AUTOEXEC.SAS file:
[pre]
ods path sasuser.mytemp(update)
sasuser.templat(update)
sashelp.tmplmst(read);

ods html file='oscar.html' style=mystyle;
[/pre]
and then your template (if it's in sasuser.mytemp) will be found and used.

If none of this is what you meant by your question, then your best bet for help would be to contact Tech Support.

cynthia

(Starting in SAS 9.2, there is also a CSSSTYLE that you can use with HTML, RTF and PDF that has more options available than the STYLESHEET=(URL=) option -- mostly in the fact that you can use CSSSTYLE to point to EITHER a SAS style template or to a CSS File.)
SAS Employee
Posts: 174

Re: ODS html file change default style

Another possibility is to use the SAS Registry Editor to modify the default style for ODS HTML. The registry path is ODS\DESTINATIONS\HTML and the key is named "Selected Style."

The folks in Technical Support can show you how to do this.

-- David Kelley, SAS
SAS Employee
Posts: 174

Re: ODS html file change default style

I misspoke. The registry path is ODS\DESTINATIONS\MARKUP\HTML4 and the key is named "Selected Style."

-- David Kelley, SAS
N/A
Posts: 0

Re: ODS html file change default style

thank you all, everythings working now !!!
Ask a Question
Discussion stats
  • 4 replies
  • 191 views
  • 0 likes
  • 3 in conversation