The SAS Output Delivery System and reporting techniques

ODS Excel Gridlines

Accepted Solution Solved
Reply
Contributor
Posts: 39
Accepted Solution

ODS Excel Gridlines

Hello,

 

I have two questions in regards to adding gridlines to a specific style. I have been using the style sasweb for some reporting, and I would like to retain everything about that style with the caveat that I want the gridlines to be shown in all tables/reports instead of the classic all white background that it currently shows. I tried the code below, and it does successfully show gridlines, but doesn't retain the rest of SASWEB formatting.

 

My second question is, the code below overwrote the old sasweb formatting. Is there any way to restore the styles. library?

 

Thank You.

 

proc template;

define style Styles.sasweb;

parent=styles.excel;

class body / background=_undef_;

end;

run;

 

ods excel file="test"

options(sheet_name="Test")

options(sheet_interval="PROC"

embedded_titles="yes"

embedded_footnotes="yes"

embed_titltes_once="yes")

style=sasweb;


Accepted Solutions
Solution
‎01-18-2017 10:50 AM
Super User
Posts: 11,343

Re: ODS Excel Gridlines

Posted in reply to jacob_klimek

If you want most of the behavior from a given style then use that as the parent and specify a NEW name for the result:

proc template;
   define style Styles.Mysasweb;
   parent=Styles.sasweb;
run;

Find the style element from a different style, such as styles.excel and insert those characteristics.

 

I don't believe you can inherit from two parents so the you would need to post the actual styles.excel code for the Class body section.

 

Then use your new style either as your default style or only on the output you want with the Style= option.

View solution in original post


All Replies
Contributor
Posts: 39

Re: ODS Excel Gridlines

Posted in reply to jacob_klimek

Just realized I can just clear out of my session for the second part. Still can't figure out the first part however.

Solution
‎01-18-2017 10:50 AM
Super User
Posts: 11,343

Re: ODS Excel Gridlines

Posted in reply to jacob_klimek

If you want most of the behavior from a given style then use that as the parent and specify a NEW name for the result:

proc template;
   define style Styles.Mysasweb;
   parent=Styles.sasweb;
run;

Find the style element from a different style, such as styles.excel and insert those characteristics.

 

I don't believe you can inherit from two parents so the you would need to post the actual styles.excel code for the Class body section.

 

Then use your new style either as your default style or only on the output you want with the Style= option.

SAS Super FREQ
Posts: 8,862

Re: ODS Excel Gridlines

Posted in reply to jacob_klimek

Hi:

  This is not a good idea:

proc template;
   define style Styles.sasweb;
   parent=styles.excel;

  I never, never, NEVER, recommend defining a style with the same name as the SAS-defined style. Anyone who uses your code will see style=sasweb and will not understand why they are not getting the same results as you are getting. And, then, if you are running a local version of SAS, I have seen people corrupt their template store accidentally by having the wrong permissions on the SAS production template store (SASHELP.TMPLMST). So, never a good idea to attempt to redefine or define a new style with the same name as an production style template.

 

Instead, I would expect to see:

proc template;
   define style Styles.newstyle;
   parent=styles.parentstyle;


OR, for your code:

proc template;
   define style Styles.myexcel;
   parent=styles.sasweb;



  I sincerely hope that the code you posted was a typo and that you have not accidentally ruined the production version of the SASWEB style.

 

cynthia

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 463 views
  • 0 likes
  • 3 in conversation