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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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