Desktop productivity for business analysts and programmers

How to create a .css file with a proc template

Posts: 33

How to create a .css file with a proc template

Hi everybody,

I used to use a sas programme containing a proc template to define my reporting style on SAS 9.3, ans now I'm working on SAS EG, and I want to do the same thing in a CSS style.

the question is: how to transform my proc template programm in a css style wich i can use permanently.


Posts: 9,424

Re: How to create a .css file with a proc template


  To create a CSS file from an ODS style template (such as the SASWEB style), is very simple. Basically, you use ODS HTML and the STYLESHEET= option and run it 1 time to get the CSS version of the template created. Like this:

ods html path='c:\temp' (url=none)





proc print data=sashelp.class(obs=1);


ods html close;

Now, open c:\temp\sasweb.css with Notepad or a text editor and you have the SAS style template "translated" to CSS form. The style you specify in the STYLE= option is the one that will be "translated" and written to the STYLESHEET= file.


If you have made your own style template that you want to convert to CSS form, then you may need an ODS PATH statement to point to your template store, but it will basically be the same thing.

Or, you can use the style wizard in EG to just edit an CSS file directly in order to make a new CSS file.

Also, after you create the CSS file, you may need to deploy it on the server either using EG or copying it. To reference a CSS, you may or may not use code, depending on how you intend to use it. STYLESHEET=(URL=) is the ODS HTML way to reference a CSS file; or CSSSTYLE can be used to reference a CSS file. For EG and SASREPORT you would need to use the STYLESHEET=(URL=) method. Or, if you have put the CSS into a location where EG knows to look, you can just define it using the pulldown menus under Tools --> Options --> Results and EG will put it into the code for you.

For some other examples and more explanation, see this paper:


Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation