Notice that all of the recommended
styles use Sans-Serif fonts. The following example shows how to create
a custom style that uses Serif fonts instead. The example uses the
STATISTICAL style as a starting point (parent) for the custom style.
The following PROC
TEMPLATE code shows the beginning of the style definition for the
STATISTICAL style, which is delivered with the SAS System. Only the
code to be modified is shown.
proc template;
define style Styles.Statistical;
parent = styles.default;
style fonts /
'TitleFont2'=("<sans-serif>, <MTsans-serif>, Helvetica,Helv",2,bold)
'TitleFont'=("<sans-serif>, <MTsans-serif>, Helvetica,Helv",3,bold)
'StrongFont'=("<sans-serif>, <MTsans-serif>, Helvetica,Helv",2,bold)
'EmphasisFont'=("<sans-serif>, <MTsans-serif>, Helvetica,Helv",2,italic)
'FixedFont'=("<monospace>, Courier",2)
'BatchFixedFont'=("SAS Monospace, <monospace>, Courier, monospace",2)
'FixedHeadingFont'=("<monospace>, Courier, monospace",2)
'FixedStrongFont'=("<monospace>, Courier, monospace",2,bold)
'FixedEmphasisFont'=("<monospace>, Courier, monospace",2,italic)
'headingEmphasisFont'=("<sans-serif>, <MTsans-serif>, Helvetica,
Helv",2,bold italic)
'headingFont'=("<sans-serif>, <MTsans-serif>, Helvetica, Helv",2,bold)
'docFont'=("<sans-serif>, <MTsans-serif>, Helvetica, Helv",2);
style GraphFonts /
'GraphDataFont'=("<sans-serif>, <MTsans-serif>",7pt)
'GraphUnicodeFont'=("<MTsans-serif-unicode>",9pt)
'GraphValueFont'=("<sans-serif>, <MTsans-serif>",9pt)
'GraphLabelFont'=("<sans-serif>, <MTsans-serif>",10pt)
'GraphFootnoteFont'=("<sans-serif>, <MTsans-serif>",10pt,italic)
'GraphTitleFont'=("<sans-serif>, <MTsans-serif>",11pt,bold)
'GraphAnnoFont'=("<sans-serif>, <MTsans-serif>",10pt);
/* more code */
end;
run;
We will
make the following changes:
-
Assign a name to a new style that
identifies STATISTICAL as its parent style. It is recommended that
you create a new style of a different name so that access to the existing
style is not blocked. See discussion
under Controlling ODS Search Paths.
-
Change the Fonts style element
(affects tables) so that it uses Serif fonts.
-
Change the GraphFonts style
element (affects graphs) so that it uses Serif fonts.
Two style
elements govern all fonts in a style: the Fonts element governs tables,
and the GraphFonts element governs graphs. When changing fonts in
a style, be sure to make consistent changes to both elements. In this
case, we want to change from a sans-serif font to a serif font. You
can also change font size, weight, and style.
In style templates,
the name of a font family normally appears as a quoted string. However,
ODS also supports an indirect reference to a font family. When a font
name appears between less than and greater than symbols, such as <
sans-serif>, it means that the font family
sans-serif is defined in the SAS Registry. For
the Windows Release of SAS, here are some of the registry keys and
values that are stored under
ODSFonts:
Registry Keys and Values for Fonts in the Windows Release of
SAS
The registry
definition of MTsans-serif and MTserif refer to TrueType fonts that
are shipped with SAS and are similar to "Arial" and "Times New Roman."
These "MT" fonts (short for Monotype) can be used on any computer
where SAS is installed. A specific font family such as "Verdana" could
be used instead. Note that fonts are normally listed in a "most-specific"
to "most generic" order so that reasonable substitution can be made
when a font cannot be located on the current computer.
Notice
that several graph fonts affect different parts of a graph. The following
table shows some but not all features that are affected by the graph
fonts:
|
Used for all
titles of the graph. Typically the largest font.
|
|
Used for all
footnotes. Typically smaller than the titles. Sometime footnotes are
italicized.
|
|
Used for axis
labels and legend titles. Generally smaller than titles.
|
|
Used for axis
tick values and legend entries. Generally smaller than labels.
|
|
Used for text
where minimum size is necessary (such as point labels).
|
|
|
|
Default font
for text added as annotation in the ODS Graphics Editor.
|
The
SAS Output Delivery System: User's Guide provides information
and examples of all predefined style elements and attributes.
In our
example, we will name our modified style template
SerifStatistical , change all occurrences of
sans-serif to serif, change all occurrences of MTsans-serif to MTserif,
and change Helvetica and Helv (sans-serif fonts) to Times (a serif
font):
proc template;
define style Styles.SerifStatistical ;
parent = styles.statistical;
style fonts /
'TitleFont2'=(" <serif> , <MTserif> , Times ",2,bold)
'TitleFont'=(" <serif> , <MTserif> , Times ",3,bold)
'StrongFont'=(" <serif> , <MTserif> , Times ",2,bold)
'EmphasisFont'=(" <serif> , <MTserif> , Times ",2,italic)
'FixedFont'=("<monospace>, Courier",2)
'BatchFixedFont'=("SAS Monospace, <monospace>, Courier, monospace",2)
'FixedHeadingFont'=("<monospace>, Courier, monospace",2)
'FixedStrongFont'=("<monospace>, Courier, monospace",2,bold)
'FixedEmphasisFont'=("<monospace>, Courier, monospace",2,italic)
'headingEmphasisFont'=(" <serif> , <MTserif> , Times ",
2,bold italic)
'headingFont'=(" <serif> , <MTserif> , Times ",2,bold)
'docFont'=(" <serif> , <MTserif> , Times ",2);
style GraphFonts /
'GraphTitleFont'=(" <serif> , <MTserif> ",11pt,bold)
'GraphFootnoteFont'=(" <serif> , <MTserif> ",10pt,italic)
'GraphLabelFont'=(" <serif> , <MTserif> ",10pt)
'GraphValueFont'=(" <serif> , <MTserif> ",9pt)
'GraphDataFont'=(" <serif> , <MTserif> ",7pt)
'GraphUnicodeFont'=(" <MTserif-unicode> ",9pt)
'GraphAnnoFont'=(" <serif> , <MTserif> ",10pt);
end;
run;
Note: By assigning
the parent to STYLES.STATISTICAL, we need to change only two style
elements. The rest of the elements are inherited.