The SAS Output Delivery System and reporting techniques

Change Style during ODS Tagsets.ExcelXP

Reply
Frequent Contributor
Posts: 84

Change Style during ODS Tagsets.ExcelXP

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??

SAS Super FREQ
Posts: 8,721

Re: Change Style during ODS Tagsets.ExcelXP

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;

Frequent Contributor
Posts: 84

Re: Change Style during ODS Tagsets.ExcelXP

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.

Esteemed Advisor
Esteemed Advisor
Posts: 7,250

Re: Change Style during ODS Tagsets.ExcelXP

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.;

...

Ask a Question
Discussion stats
  • 3 replies
  • 526 views
  • 3 likes
  • 3 in conversation