BookmarkSubscribeRSS Feed
wcp_fnfg
Obsidian | Level 7

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

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

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;

wcp_fnfg
Obsidian | Level 7

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

...

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1682 views
  • 3 likes
  • 3 in conversation