BookmarkSubscribeRSS Feed
gerolo
Calcite | Level 5

Hey,

I have created my own Style in SAS Foundation with the Template procedure. I tried to print a report with that own Style and it worked in Foundation. Then I tried to do the same in Enterprise Guide. Here I created a SAS program to create the own Style and another SAS program to create a report with this own style. The results of that program there are a SAS report and a HTML report. The HTML report is stored on the hard drive with my own style but the SAS report still uses the default style HTMLBlue. How can I change that without using the style manager? I don't want to use the style manager because I want to use that own style on different computers, so I don't want to create a new style in style manager for each computer.

Could anyone help me please?

My Code for the own style ist the following:

proc template;

     define style OwnStyle;

          parent = Styles.HTMLBlue;

          class body /

                backgroundcolor = white

                color = black

                fontfamily = Calibri

          ;

          class SystemTitle /

                backgroundcolor = white

                fontfamily = "Calibri"

                fontsize = 16pt

                fontweight = bold

               color = green

          ;

          class SystemFooter /

                fontfamily = "Calibri"

                fontsize = 8pt

                fontweight = bold

                color = purple

          ;

          class table /

                backgroundcolor = #f0f0f0

                bordercolor = black

                borderstyle = solid

               borderwidth = 1pt

                cellpadding = 5pt

                cellspacing = 0pt

                frame = void

                rules = groups

          ;

          class header, footer /

                backgroundcolor = green

                color = purple

                fontfamily = "Calibri"

                fontweight = bold

          ;

          class data /

                fontfamily = "Calibri"

          ;

          class colors /

             'batchbg' = white

             'bylinebg' = white

             'bylinefg' = green

             'captionbg' = white

             'captionfg' = green

             'contentbg' = white

             'docbg' = white

             'headerbg' = white

             'link2' = green

             'link1' = cx800080

             'notebg' = white

             'notefg' = green

             'proctitlebg' = white

             'proctitlefg' = green

             'tablebg' = white

             'titlebg' = white

             'titlefg' = green

          ;

     end;

run;

My Code for the reports is the following:

ods html file='c:\Testdaten\sample2.html' style=OwnStyle;

title 'My Sample Title';

footnote 'My Sample Footnote';

proc report data=sashelp.class nowd style=OwnStyle;

       column age height weight;

       define age / group;

       define height / mean f=8.;

       define weight / mean f=8.;

run;

proc sort data=sashelp.class out=work.class;

       by sex;

run;

proc print data=work.class style=OwnStyle;

       by sex;

run;

ods html close;

Thanks in advance,

gerolo

10 REPLIES 10
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Why in your style = statements in the html, and proc reports, do you use the OwnStyle text, when you have defined your template as Q_Perior?  Change either to the same and it should then work.

gerolo
Calcite | Level 5

Sorry, this was a copy paste mistake. In the code I use the same words.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Ok.  Could you clarify what you mean by the SAS report is not using the style.  Do you mean the report window which opens as default, which you can bypass by adding nowindows to the report statement?  If so, I think that's a fixed format output.  I would suggest use the HTML or create PDF/RTF etc. for viewing.

gerolo
Calcite | Level 5

Unbenannt.JPG

Yes I mean the window which opens as default (in the picture the middle one (SAS Report - Report) but it still opens by adding nowindows to the report statement.

I think it isn't a fixed format output because I tried to create a style with the style manager of Enterprise Guide and made this style as default. After that the style of the SAS Report was the new default Style created by myself.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Mmm, well I don't use Enterprise Guide.  With Base SAS I would always switch that output off with nowindows and re-direct to my own files.  However I know in Base SAS under the options is:

Tools->Options->Preferences-> Results

In there is an option to create HTML output and you can select style.  Maybe that helps.

gerolo
Calcite | Level 5

If I use a file= statement with ods sasreport, the sas report on the hard disk uses my own style, but the normal SAS Report output which is defined in the options has ther default HTMLBlue style.

( ods sasreport file='c:\Testdaten\test.test' style=OwnStyle; )

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Somewhere in your options there should be one which defines this, and you can select any template from a drop down, at least I can in Base SAS under Tools->Options->Preferences-> Results. 

Reeza
Super User

In EG 5.1

Tools>Options>Results > Choose your Destination (HTML, RTF, PDF) - there you can change your Default Style and add any default additional options for ODS HTML.

I'm not sure how to add the style in though.

jwillis
Quartz | Level 8

Gerolo,

I suspect that you are having issues with where Enterprise Guide is going to find your personal template.  In the book "Getting Started with Enterprise Guide", the book says Enterprise Guide is designed to work with a Server version of SAS or a local version of SAS.  I suspect* that you need to create a personal template in the location that your EG session looks for templates.  Kevin D. Smith authored a book on Proc Template.  Perhaps he knows the solution to your problem.  "Proc Template Made Easy: A Guide for SAS Users", page 20.

*I am brand new to EG ;  I create personal templates; and I do not know where EG goes to find personal templates.  I am keenly interested in learning what your final solution becomes. 

Message was edited by: James Willis

gerolo
Calcite | Level 5

I think the problem is that the Enterprise Guide executes his own code before it executes my code, because it wants to use the default style which is set in the style manager for each output which is defined in the options.

The EG executes this code at the beginning:

1          ;*';*";*/;quit;run;

2          OPTIONS PAGENO=MIN;

3          %LET _CLIENTTASKLABEL='Style anlegen';

4          %LET _CLIENTPROJECTPATH='C:\Testdaten\Test_StyleProjekt.egp';

5          %LET _CLIENTPROJECTNAME='Test_StyleProjekt.egp';

6          %LET _SASPROGRAMFILE=;

7         

8          ODS _ALL_ CLOSE;

9          OPTIONS DEV=ACTIVEX;

10         GOPTIONS XPIXELS=0 YPIXELS=0;

11         FILENAME EGSR TEMP;

12         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR STYLE=HTMLBlue

12       ! STYLESHEET=(URL="file:///C:/Program%Files/SASHome/x86/SASEnterpriseGuide/5.1/Styles/HtmlBlue.css") NOGTITLE NOGFOOTNOTE

12       ! GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on") style=OwnStyle;

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

Here the EG uses the default style for the SAS reports which is set in the style manager.

I think I need a statement to set my own style (which is made with the Proc Template statement) as default.

Does anybody know a statement to set the default style without using the style manager?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 10 replies
  • 1317 views
  • 0 likes
  • 4 in conversation