BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9
Hello,

is there any information available about writing your own stylesheet for outputting proc reports like meadow,sasweb?

Or does anyone has experience with this?
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
Are you specifically interested in graphical output or, as implied by your subject, in tabular output created by PROC REPORT??

The easiest way to find out how a SAS style template (like MEADOW or SEASIDE) will translate to CSS style property/value format is to use ODS to create a CSS file for you. You can do this on a one-time basis, by using ODS HTML and the STYLESHEET= option to make a CSS file like this:
[pre]
ods html path='c:\temp' (url=none)
file='makecss.html'
style=meadow
stylesheet='copy_of_meadow.css';
proc print data=sashelp.class(obs=1);
run;
ods html close;
[/pre]

If you use the above code, then the c:\temp directory will hold a file called "copy_of_meadow.css" that you can open with Notepad and edit.

Alternately, if you have SAS Enterprise Guide, there is a very nice Style Wizard that will allow you to make a new CSS file using MEADOW as your starting point (or the style of your choosing). This Style Wizard is actually a CSS editor because EG uses a CSS version of the SAS style templates with the reports created by EG.

cynthia
Filipvdr
Pyrite | Level 9
What i maybe forgot to tell is i'm using this in Stored Processes.

I got the following for the moment:


-MacroProcReport
[pre]
/* Stylesheet */
%macro use_stylesheet(stylesheet_name);

%global _ODSDEST;

ODS PATH (prepend) work.templat(update);

proc template;
define tagset tagsets.nostyle;
parent=tagsets.html4;
embedded_stylesheet=no;
end;
run;

ods html body=_webout
stylesheet=(URL="&stylesheet_name");

ods html close;

%let _ODSDEST=tagsets.nostyle;

%mend use_stylesheet;

%use_stylesheet(http://imecwww.imec.be/~osp/fab300/test/StyleTest.css);

[\pre]
Run MacroProcReport

when i look into the source code of the generated HTML there is indeed a link to my stylesheet StyleTest, yet the default stylesheet is still used. can i omit this?


HTML source:

[pre]



















SAS Output
Cynthia_sas
SAS Super FREQ
Hi:
You might want to open a track with Tech Support on this question, as the use of CSS files with a stored process is usually done with an override to the automatic variable &_ODSSTYLESHEET (same concept as &_ODSDEST).

However, not all client applications will receive HTML results and some client applications (such as Web Report Studio) require that the CSS be defined in a special XML file that is available on the Middle Tier configuration files.

In addition, it is not entirely clear where you expect your &_ODSDEST of TAGSETS.NOSTYLE to be used. In fact, there already is a "nostyle" destination -- well, there are 2 -- ODS PHTML and ODS CHTML -- either of those might work for you instead of trying to come up with your own TAGSET template based on TAGSETS.HTML4. It is possible that a simple override of:
[pre]
%let _ODSDEST = CHTML;
[/pre]

might work for you without using a STYLESHEET at all.

I suspect you have some log messages about STYLE not found or TAGSET not found and that means that there is a certain amount of debugging required that will mean that someone has to look at ALL your code and understand your particular method of invoking this stored process.

To send a question to Tech Support, you can go directly to the Tech Support Problem Form here:
http://support.sas.com/ctx/supportform/createForm

cynthia
Filipvdr
Pyrite | Level 9
This is working for me:

%macro procreport(table=, cols=, groupvalues=, byvariable=,text1=,text2=);
ods html file=_webout stylesheet=(URL="http://imecwww.imec.be/~osp/fab300/test/ImecStyle.css");
....
%mend;

thanks

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1850 views
  • 0 likes
  • 2 in conversation