So I've got an ODS output using ExcelXp. Let's say I do a proc report then a proc tabulate, I'd like the tabulate to be a different style (like SASWeb, Meadow or Normal) than the report. Is that possible??
Hi, sort of. The style information is only written one time so there's no way to use a simple ODS destination level STYLE= option to change the style. But, REPORT, PRINT and TABULATE all have a way to provide STYLE= overrides at the STATEMENT level (down in the statement syntax instead of on the ODS statement). Please see the attached code. The SASWEB style will be used for BOTH outputs, but the overrides in the TABULATE step will change the output elements to be what is contained in the { } at the TABULATE statement level.
Cynthia
ods listing close;
ods tagsets.excelxp file='c:\temp\change_style.xml' style=sasweb;
proc report data=sashelp.class nowd;
run;
proc tabulate data=sashelp.class;
class age / style={background=pink color=black fontweight=bold};
var height / style={background=pink color=black fontweight=bold};
classlev age / style={background=pink color=black fontweight=bold};
table age all='Overall',
height*(min mean max median) /
box={style={background=pink color=black fontweight=bold}};
keyword min mean max median all/ style={background=pink color=black fontweight=bold};
run;
ods _all_ close;
Thanks. So I can't just use style= in the proc line, I'd have to manually change the elements? That's too bad, but at least this is something.
As Cynthia has mentioned, the style= indicates a base template *for the document*. Its pretty common.
You could however shrink your code somewhat by macrotizing (if that's a word) your styling. Something like:
%let def_style={background=pink color=black fontweight=bold};
%let highlight_style={background=yellow color=red fontweight=bold};
...
ods tagsets.excelxp "..." style=default;
proc tabulate ....
class age / style=&def_style.;
...
run;
proc tabulate ...
class other / style=&highlight_style.;
...
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.