BookmarkSubscribeRSS Feed
ScottBass
Rhodochrosite | Level 12

Hi,

In EG I did the following:

Tools --> Style Manager

I created a copy of Normal, NormalPrinter, and RTF

I (very minimally) edited each style, changing Body Font and Header/RowHeader background and foreground colors to my company's logo colors.

Tools --> Options --> Results

I changed SAS Report and HTML to MyCompanyNameNormal

Questions:

1) For PDF and RTF, my user defined styles don't show up in the dropdown list.  Why is that?  So, in Additional options for ODS <PDF|RTF> statement, I added style=MyCompanyNameNormalPrinter and style=MyCompanyNameRtf for PDF and RTF respectively.

2) I now get warnings in EG, even though the styles in fact exist:

11 FILENAME EGHTML TEMP;

12 ODS HTML(ID=EGHTML) FILE=EGHTML ENCODING='utf-8' STYLE=MyCompanyNameNormal

12       ! STYLESHEET=(URL="file:///C:/Documents%20and%20Settings/sbass/Application%20Data/SAS/SharedSettings/Styles/MyCompanyNameNormal.css"

12       ! ) NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation;

WARNING: Style MYCOMPANYNAMENORMAL not found; Default style will be used instead.

NOTE: Writing HTML(EGHTML) Body file: EGHTML

13 FILENAME EGRTF TEMP;

14 ODS RTF(ID=EGRTF) FILE=EGRTF ENCODING='utf-8' STYLE=Rtf NOGTITLE NOGFOOTNOTE style=MyCompanyNameRtf;

WARNING: Style MYCOMPANYNAMERTF not found; Rtf style will be used instead.

NOTE: Writing RTF Body file: EGRTF

15 FILENAME EGPDF TEMP;

16 ODS PDF(ID=EGPDF) FILE=EGPDF STYLE=printer SAS AUTHOR="Scott Bass" KEYWORDS="Enterprise Guide" style=MyCompanyNameNormalPrinter;

WARNING: Style MYCOMPANYNAMENORMALPRINTER not found; Printer style will be used instead.

NOTE: Writing ODS PDF(EGPDF) output to DISK destination "EGPDF", printer "PDF".

17 FILENAME EGSR TEMP;

18 ODS tagsets.sasreport12(ID=EGSR) FILE=EGSR STYLE=MyCompanyNameNormal

18       ! STYLESHEET=(URL="file:///C:/Documents%20and%20Settings/sbass/Application%20Data/SAS/SharedSettings/Styles/MyCompanyNameNormal.css"

18       ! ) NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on");

WARNING: Style MYCOMPANYNAMENORMAL not found; Default style will be used instead.

NOTE: Writing TAGSETS.SASREPORT12(EGSR) Body file: EGSR

The output appearance for SAS Report and HTML is correct, it just looks like a bogus warning message in EG. 

3) The output for PDF and RTF did not use my styles.

Any thoughts re: these three issues?

Thanks,

Scott


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
12 REPLIES 12
ballardw
Super User

CSS are not SAS Styles. I suspect that you either did not make your style using PROC TEMPLATE or placed it somewhere other than the current style search path.

The WARNINGS tell you the style either doesn't exist at all or can't be found (same message). If SAS cant find them it can't use them.

HTML does use CSS. RTF and PDF do not, they use the SAS style.

ScottBass
Rhodochrosite | Level 12

I made the style as stated above, by using EG Tools --> Style Manager.  Once I create these user defined styles, it provides a dropdown to select this style for SAS Results and HTML.  But then generates warnings in the SAS log, yet applies the style to the output!!!

Since my original post, I did see in the doc that PDF and RTF don't support styles, but do support cssstyles.  So, perhaps that's why the user defined styles aren't available for PDF and RTF?

I'm using EG 4.3, BTW.  Perhaps this is enhanced in EG 5.1?

Regardless, I still don't see why I'm getting the warnings for SAS Results and HTML.


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
Cynthia_sas
SAS Super FREQ

Hi:

  Note that your EG-generated code has both a STYLE= and a STYLESHEET= option. It seems redundant, I know. But your warnings are coming from SAS and ODS when the STYLE= option references a style template that cannot be found in the ODS PATH search locations. So, those are not bogus warning messages. The warning (#2)  is for the STYLE= style template not being found. Since the STYLESHEET= location is pointing to FILE:// location, when the STYLE template fails, and a warning gets issued, then the STYLESHEET= option can ride in and save the day (for HTML and SASReport XML). When you use the STYLE Wizard, you really are editing a CSS (Cascading Style Sheet) version of a SAS style template. When you made MyCompanyNameNormal using the Style Wizard, you were creating the style definition as a CSS file, and it was saved in a local location. But your style template definition needed to be saved to a template location that was available to SAS on the server. You need to control this with an ODS PATH statement. Even if you made a copy of your STYLE template on your server machine, by default, it would have been written to your SASUSER location, which may or may not be a persistent location, depending on your configuration.

  This Tech Support note shows using SASHELP.TMPLMST http://support.sas.com/kb/37/480.html and explains how to get your styles into the drop down list (your #1). I do not normally recommend updating SASHELP.TMPLMST directly because SASHELP.TMPLMST contains SAS-supplied templates and if you put your templates here, the next time SAS is updated or installed again, it could wipe out your changes to this location. Also, you have to be REALLY, REALLY sure that your code is correct, so you don't accidentally corrupt SASHELP.TMPLMST.

  For #3, The good news is that you can use a CSS style sheet with RTF and PDF. However, instead of the STYLESHEET= option, you would need to use the CSSSTYLE= option for those two destinations. (http://support.sas.com/kb/38/100.html) This means that you would have to modify the code for PDF and RTF submissions. OR, as an alternative, if you get your style templates up on the server (see #1 answer), then you can use a simple STYLE= with RTF and PDF because you can select them from the drop down box.

  I hope this helps,

cynthia

ScottBass
Rhodochrosite | Level 12

Hi Cynthia,

Thanks.  I understand most of this, actually.

Let me restate my question:  why does EG 4.3 allow me to use the Style Manager to create a new style(sheet), offers this as a selection from the dropdown list for Results and HTML, but then generates incorrect SAS code?  Would this code work properly if the STYLE= option was dropped, and only STYLESHEET was present?

I'll hit those usage notes in the morning and see if I can coax EG to use the stylesheets created (by EG) without generating a warning.  Otherwise, I'll look into PROC TEMPLATE saved to a permanent library and ODS PATH.  It would be nice if all our EG users generated output with the company colors and logo (merely be setting default options in EG).

Thanks,

Scott


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
Cynthia_sas
SAS Super FREQ

Hi:

  My best guess-timate is that using the Style Wizard was planned as something an end user would do as step 1 of a process. They would fiddle with the Style Wizard and come up with a CSS that they liked. Then, since style templates live on the SAS server in an item store, I would guess that the idea was that for step 2, the end user would go to their SAS administrator and say something like -- "Look at this cool style I've come up with -- everybody wants to use it. Can you put it in a place where everybody can get to it?" And the magic "place where everybody can get to it" would be the item store for style templates or a shared item store. Otherwise, everybody has to have a copy of the CSS locally or on a shared drive which is a pain to administer.

  For step 3, the SAS Administrator could then run code to import the CSS created in the Style Wizard into a SAS style template definition on the SAS Server, in an item store that's available to the server via using ODS PATH. Then, using STYLE= would work for RTF, PDF and HTML. In that scenario, STYLE= would not fail. When the end user tried to use the code the first time and got the warning (and it is just a warning) that should prompt action that involves the SAS Administrator. So the warning is a good thing in my mind, because it's an indication that something -else- needs to happen to turn the edited CSS into an available style template.

  If I had to design how it worked, I'd design it the way it works -- style definitions are not usually proliferated in local directories. CSS files are normally stored on a web server and SAS Style templates are normally stored in a template store on a SAS server.  That warning did you a favor, possibly a favor that comes with a learning curve, but still a favor because once you get it worked out, you will have created a style definition that can be used by other folks.

  There is an example of importing a CSS file into a SAS style template in my paper on style templates:

http://support.sas.com/resources/papers/proceedings10/033-2010.pdf  (page14) and

learn more about CSS in this paper: http://support.sas.com/resources/papers/proceedings09/014-2009.pdf

and for an overview of templates and item stores: http://support.sas.com/resources/papers/proceedings09/227-2009.pdf

I did not show the ODS PATH with PREPEND for EG, but there are examples of that in the Tech Support notes, here's one: http://support.sas.com/kb/23/455.html

cynthia

MichelleHomes
Meteorite | Level 14

Hi Scott,

A workaround that I have done in the past to get around the warning messages is to rename the custom style to a SAS defined style name. Set it as your default and Enterprise Guide seems to cope with that and you don't get the warning messages about the style appear for each task that is run. I did this in EG 4.1 so not sure whether it is still the case in EG 4.3 or EG 5.1

Cheers,

Michelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
Cynthia_sas
SAS Super FREQ

Hi, Michelle:

  The downside of this approach is that if and when the SAS.EXE program is upgraded or reinstalled, you may lose your user-defined style. Let's say you name your updated style SASWEB and then SAS is reinstalled on the server. Depending on where you saved your copy of SASWEB and whether you saved it as a style template or a CSS file, and where you saved your user-defined style (on the server or in a local directory) your reports could revert to the SAS-supplied SASWEB after the reinstall. While this is a possible workaround, it has long term consequences that may be undesirable.

More food for thought,

cynthia

MichelleHomes
Meteorite | Level 14

HI Cynthia,

I agree it isn't the best approach and relies on the stability of the SAS environment and the SAS Administrator to be on top of this. If the alternative is to have a SAS log file that has unnecessary warning messages for every SAS request, then it is an option with caveats people need to be aware of (thanks for pointing them out).

Best situation would be for the style message to be a note rather than a warning in the log... Any chance passing this onto R&D?

Cheers,

MIchelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
Cynthia_sas
SAS Super FREQ

Hi:

  I'm pretty sure the R&D folks cruise by the forums for a little light reading.

  But, my .02 is that I still think the message is appropriate as a warning message. Not saving the style correctly can cause issues if the updated style is not dealt with, either as a CSS file or as a style template. As a note, there is the implication that everything is OK; when, in fact, everything is not OK if the style is not stored properly. The SAS Administrator needs to be involved. I do understand that the SAS log gets full of warning messages, but eventually, when someone gets tired of the warning messages, I would hope it would prompt them to ask the question about how to get rid of the warning once and for all.

cynthia

ScottBass
Rhodochrosite | Level 12

Hi Cynthia and Michelle,

I haven't had time to read the links listed above.  I also haven't had time to play with and test the code generated by EG.  For example, when both a STYLE= (template) and STYLESHEET= (CSS) option is specified, which takes precedence?

However, without testing this further (so feel free to correct my errors), this is how I wish EG worked:

1)  The Style Manager is a GUI to creating a CSS stylesheet and/or style template.

2)  If all it does is create a CSS stylesheet, then don't add the STYLE= option to the generated code!  IOW, even with the current code, if all the Style Manager did was create a CSS, then IMO adding the STYLE= option when I selected a user-defined stylesheet is a design bug.

3)  If a CSS stylesheet can be converted to a style template (http://support.sas.com/resources/papers/proceedings10/033-2010.pdf, but I haven't read it yet), then EG should build the code to make that happen.  Give an option to specify a permanent libref to save the style template to.  Or, with the caveat that ODS PATH must have been set, else it's going in SASUSER.  IOW, the EG Style Manager is a GUI for both style template and css stylesheet creation.

4)  If the Style Manager creates a CSS stylesheet, and CSSSTYLE= is available for Results/HTML/PDF/RTF, then allow the user-defined stylesheet to be selected from the dropdown.  Or perhaps a radio button for Style Template | CSS Stylesheet, with the dropdown changing based on the list of style templates or css stylesheets available.

5)  It would be nice if EG displayed ALL available style templates in the dropdowns, based on the ODS PATH.  But I know this could be an issue with local vs. remote servers.  Perhaps add a dropdown for each workspace server defined in the configuration, and a "Refresh Styles" button to populate the dropdown list.  In this way, I could select a different style for each workspace server.  Allow me to set a single default style template (probably SAS defined) to apply to all workspace servers that do not have a specific style template defined.

Bottom line:  if I use Tools --> Style Manager, create my style, save it in the default location, then select the created style from the dropdown list, at a minimum I wouldn't expect EG to generate code that creates warnings for every single program!!!  So I have to disagree with you Cynthia that the warning is a good thing.  Again, what would happen if the STYLE= option was dropped from the generated code (but the STYLESHEET= option remains)?  From my limited testing, the STYLESHEET still applies, and I get my desired results.

Re: the stability of naming the user-defined CSS styles the same name as SAS supplied styles, by default my user-defined css stylesheet was save in <username>\Application Data (or somesuch - I'm sending this from home and can't look it up).  So, I don't see why a SAS upgrade would overwrite that directory?  I think it's just a kludge so the EG generated code doesn't generate a warning, and the stylesheet takes precedence over the SAS supplied style template.  And I don't see SAS dropping any style templates in a future upgrade.

Finally, I tried manually coding CSSSTYLE= for PDF and RTF, but couldn't work out the URL syntax.  Plus, I suspect the path would be different whether the workspace server was local or remote, but the UI only allows a single line of code, for all workspace servers.  Perhaps I can copy the CSS generated by the Style Manager to a URL served up by a web server???

Thanks Michelle and Cynthia for your replies.  Much appreciated.

Scott


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
Cynthia_sas
SAS Super FREQ


Hi, Scott:

  Here's an example of code that shows 2 different specifications. The STYLE= option is listed first and the CSS specification (either STYLESHEET= or CSSSTYLE=) is listed 2nd. In this instance, order of options matters & the style used for all the outputs is the ANALYSIS style.

** for a test, specify STYLE= first and then specify STYLESHEET= second;
** in this case, STYLESHEET=  or CSSSTYLE= wins;
ods _all_ close;
     
ods html file='c:\temp\test1.html' style=sasweb
STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/x86/SASEnterpriseGuide/4.3/Styles/Analysis.css");

proc print data=sashelp.class;
title 'style = option was SASWEB (1st), STYLESHEET= option was ANALYSIS (2nd)';
run;
ods _all_ close;

    

ods pdf file='c:\temp\test2.pdf' style=sasweb
CSSSTYLE="C:/Program Files/SASHome/x86/SASEnterpriseGuide/4.3/Styles/Analysis.css";

   

ods rtf file='c:\temp\test2.rtf' style=sasweb
CSSSTYLE="C:/Program Files/SASHome/x86/SASEnterpriseGuide/4.3/Styles/Analysis.css";

  

proc print data=sashelp.class;
title 'style = option was SASWEB (1st), CSSSTYLE= option was ANALYSIS (2nd)';
run;
  

ods _all_ close;

  But in the next bit of code, the specifications for style are given in a different order. The CSS file is listed first; and the STYLE= option is listed second. In this case, the template specified in STYLE= option is used for all the output:

** change order of options;

** specify css file first and list style= second;

** in this case, STYLE= wins;

ods _all_ close;

         

ods html file='c:\temp\test3.html'

STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/x86/SASEnterpriseGuide/4.3/Styles/Analysis.css")

style=sasweb;

   

proc print data=sashelp.class;

title 'STYLESHEET= option was ANALYSIS (1st) STYLE= was SASWEB (2nd)';

run;

ods html close;

   

ods pdf file='c:\temp\test4.pdf'  notoc

CSSSTYLE="C:/Program Files/SASHome/x86/SASEnterpriseGuide/4.3/Styles/Analysis.css"

style=sasweb;

   

ods rtf file='c:\temp\test4.rtf'

CSSSTYLE="C:/Program Files/SASHome/x86/SASEnterpriseGuide/4.3/Styles/Analysis.css"

style=sasweb;

   

proc print data=sashelp.class;

title 'CSSSTYLE= option was ANALYSIS (1st) STYLE= was SASWEB (2nd)';

run;

ods _all_ close;

And in this second case, the style specification (STYLE= option) listed 2nd takes precedence -- if the STYLE= template can be found.

The first example is closer to what EG generates. Specifying the STYLE= option first is how EG generates the code by default. So if you do not make a style template equivalent of the CSS file or if the style template cannot be loaded/found, then the STYLESHEET= (or CSSSTYLE=) takes over because it was listed 2nd in the option list.

I understand what you're suggesting about the Style Wizard/Manager and someday it may act on both CSS files and style templates. But for now, it only generates CSS files and making the style template is something left to a SAS Admin who understands how to translate the CSS to a style template and put it in the right ODS PATH on the server.

When you mention "workspace servers" I hesitate a bit. If you are using the BI Plaform, there is an extra level of complexity if you want to use your new style with Web Report Studio. For WRS, the style information must be loaded into the XML configuration files that are the "behind the scenes" of WRS. We haven't even gone down that road yet. If you are using WRS and stored processes and want to use your new style in WRS, then that is a different set of storing and organizing that needs to be done. Tech Support can help you with that set of tasks.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 12 replies
  • 5268 views
  • 3 likes
  • 5 in conversation