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;
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.
Just realized I can just clear out of my session for the second part. Still can't figure out the first part however.
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.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: