ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jacob_klimek
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

3 REPLIES 3
jacob_klimek
Obsidian | Level 7

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

ballardw
Super User

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.

Cynthia_sas
SAS Super FREQ

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

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 3 replies
  • 5949 views
  • 1 like
  • 3 in conversation