Published on :
Reporting INTERNAL_CREATION

Custom ODS Style Definition

This code is also available in: Deutsch Español Français
The main objective of this code is to enhance the aesthetics of SAS©-generated outputs, particularly for reports and visualizations. The 'customSapphire' style modifies the following elements:
  • The background colors of 'Header', 'Footer', 'RowHeader', and 'RowFooter' classes are set to CXdae4f3.
  • The 'graph' class has its attribute priority set to 'none'.
  • The colors of text, reference lines, borders, outlines, grids, and axes are customized under 'GraphColors'.
  • The appearance of tables is modified to include thicker borders, cell spacing, and a specific border color (cx919191).
  • The thickness of various graph lines (borders, axes, outlines, data, box plots, grids) is uniformly set to 2px for better visibility.
Data Analysis

Type : INTERNAL_CREATION


The script does not process external data. It defines an internal style object that will then be used by SAS to format outputs. The `store=Bookdata.Template` clause indicates that the style definition will be stored in the `Bookdata` library, but does not imply the use of input data from this library for the style definition itself.

1 Code Block
PROC TEMPLATE
Explanation :
This block uses the `PROC TEMPLATE` procedure to create a new ODS style template. The initial `libname BookData` is a commented instruction to the user to define a library, but does not affect the execution of `PROC TEMPLATE` itself. The `customSapphire` style is defined as a child of the `styles.sapphire` style. It specifies custom attributes for various ODS classes (Header, Footer, RowHeader, RowFooter, graph, GraphColors, table, GraphBorderLines, etc.), allowing control over the appearance of SAS-generated reports and graphs. Colors are defined using hexadecimal codes (CX).
Copied!
1LIBNAME BookData "--insert path to SAS data sets/BookData library here if not already assigned--";
2 
3PROC TEMPLATE;
4 define style customSapphire/store=Bookdata.Template;
5 parent = styles.sapphire;
6 class Header /
7 backgroundcolor=CXdae4f3;
8 class Footer /
9 backgroundcolor=CXdae4f3;
10 class RowHeader /
11 backgroundcolor=CXdae4f3;
12 class RowFooter /
13 backgroundcolor=CXdae4f3;
14 class graph / attrpriority="none";
15
16 class GraphColors /
17 'gtext' = black
18 'gtextt' = black
19 'greferencelines'= cx808080
20 'gborderlines' = cx000000
21 'goutlines'= cx000000
22 'ggrid'= CX797c7e
23 'gaxis'= cx000000;
24 
25 style TABLE from TABLE /
26 borderwidth=3px
27 cellpadding=3pt
28 borderspacing=.05pt
29 frame=box
30 bordercolor=cx919191
31 bordercollapse=collapse;
32 
33 class GraphBorderLines / lineThickness=2px color=CX000000;
34 class GraphAxisLines / lineThickness=2px color=CX000000;
35 class GraphOutLines / lineThickness=2px color=cx000000;
36 class GraphAnnoLines / lineThickness=2px color=cx000000;
37 class GraphReference / lineThickness=2px color=cx000000;
38 class GraphWalls / lineThickness=2px;
39 class GraphDataDefault / lineThickness=2px;
40 class GraphBoxWhisker / lineThickness=2px;
41 class GraphBoxMedian / lineThickness=2px;
42 class GraphOther / lineThickness=2px;
43 class GraphConfidence / lineThickness=2px;
44 class GraphAnnoShape / lineThickness=2px;
45 class GraphDataNodeDefault /
46 linethickness = 2px
47 linestyle = 1;
48 class GraphOutliers / linethickness=2px linestyle=1;
49 class GraphGridLines / lineThickness=2px linestyle = 1 color=cx000000;
50END;
51 
52RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.