Return to SAS Notes and Concepts for ODS

Base SAS

SAS Notes and Concepts for ODS

Fonts Concepts


You can change the font face or the point size, or apply bold or italic, all by modifying the style element FONTS with the TEMPLATE procedure.

A font definition has the following format:

("font-face-1 <..,font-face-n>",font-size,keyword-list)

If you specify only one font face and its name does not include a space character, you can omit the quotation marks. If you specify more than one font face, the browser uses the first one that is installed on the system.
The interpretation of the font size depends on the browser.
specifies the font width, font style, and font weight. You can include one value for each, and in any order. Here are the keywords and their values.

medium, bold, demi_bold, extra_bold, light
italic, Roman, slant
normal, compressed, extra_compressed, narrow, wide

Default fonts are defined in the template store Sashelp.Tmplmst. See a SAS Note about viewing template source.

In the interactive mode, you can select Styles -> Default to open a template in browse mode. To open it in edit mode, use the right mouse button to select it.

Here is the style element FONTS from the Default template.

 style fonts /
    'TitleFont2' = ('Arial, Helvetica, Helv',4,Bold Italic)
     'TitleFont' = ('Arial, Helvetica, Helv',5,Bold Italic)
     'StrongFont' = ('Arial, Helvetica, Helv',4,Bold)
     'EmphasisFont' = ('Arial, Helvetica, Helv',3,Italic)
     'FixedEmphasisFont' = (Courier,3,Italic)
     'FixedStrongFont' = (Courier,4,Bold)
     'FixedHeadingFont' = (Courier,4)
     'FixedFont' = (Courier,4)
     'headingEmphasisFont' = ('Arial, Helvetica, Helv',4,Bold Italic)
     'headingFont' = ('Arial, Helvetica, Helv',4,Bold)
     'docFont' = ('Arial, Helvetica, Helv',3);

Font Tips

Like the COLOR_LIST, the strings in the style element FONTS are like nicknames. One string assigns a font to multiple parts of the output. When you change the font values that are associated to a string in the FONTS style element, you change the font every place the string is referenced or inherited.

The fonts associated with the following three strings are the most commonly modified: The string 'DocFont' controls the fonts for the majority of the output, such as the data values and the items in the table of contents. The string 'headingFont' controls the fonts for the headers. The string 'TitleFont' controls the fonts for the titles and footnotes.

Submitting only the TEMPLATE code in example 1 would generate warnings in the log, because SAS is expecting the other strings as well that map to the rest of the output. However, as shown in example 2, the EDIT statement can be used to take care of this problem. The EDIT statement makes a virtual copy of the parent template with the modifications. The other way to prevent the warnings and unwanted output is to include all of the strings within the FONTS style element, as shown in the Fonts FAQ, which follows.

/* example 1 */
proc templates;
 define style styles.newfonts;
    replace fonts /
     'TitleFont' = ('Arial, Helvetica, Helv',5,Bold)
     'headingFont' = ('Arial, Helvetica, Helv',4,Bold)
     'docFont' = ('Arial, Helvetica, Helv',3);

/* example 2 */

proc template;
  edit styles.default as style.newfonts;
      style fonts /
         'TitleFont' = ('Arial, Helvetica, Helv',5,Bold)
         'headingFont' = ('Arial, Helvetica, Helv',4,Bold)
         'docFont' = ('Arial, Helvetica, Helv',3);


Fonts FAQ

The concepts remain above, but the FAQs have been moved.
All PROC TEMPLATE FAQ have been added to the SAS Notes application for greater usability.
Check it out!

See the "Fonts" link under ODS HTML.