Specifying Fonts in SAS/GRAPH Programs |
In general, there are four ways to specify fonts. The method you choose depends on how extensively you want to change font specifications used in your program..
Many procedures support font options that enable you to specify the fonts for certain graph elements. For example, with the GCHART procedure, you can use the FONT= suboption with the PLABEL= option to control the font for the pie slice labels. With the GKPI procedure, you can use the BFONT= option to specify the font for boundary labels. Changes specified using procedure options affect the output of the current invocation of the procedure only.
For information on the font options that are available for a specific procedure, see the documentation for the procedure.
You can specify fonts in the AXIS, LEGEND, or SYMBOL global statements. Fonts specified with these statements affect the output of any procedure that references those statements. See Using SAS/GRAPH Global Statement Options to Specify Fonts.
You can specify fonts in the GOPTIONS statement. The GOPTIONS statement is also a global statement, and specifications in the GOPTIONS statement affect all output in the current SAS session. Using the FTEXT= graphics option is frequently the best solution if you are dealing with any of the following situations.
You want to specify the fonts only for the current SAS session.
You want to specify the fonts only for a specific application.
You do not need all of your output to use the same style.
You do not want your code to be dependent on registry settings or a customized style. For example, you might want to run your program as a stored process or send it to others who might not have the same registry settings.
If you want all of your output to use the same ODS style, you can create a new style by copying and modifying an existing style and changing the font settings. Your new style can be used for all your ODS output at your site to ensure a consistent appearance. If you always want all of your output to have a specific appearance, then modifying a style might be the best alternative. See Changing The Font Specifications Used By a Style.
Using SAS/GRAPH Global Statement Options to Specify Fonts |
Font options on SAS/GRAPH AXIS, LEGEND, and SYMBOL global statements enable you to specify fonts for the following:
axis labels, reference line labels, and tick mark values
legend labels and legend value descriptions
contour line labels and plot point labels
symbol value="Deep" font="CUMBERLAND AMT/bold/italic";
See Labeling Contour Lines, Modifying the Horizontal Axis, Modifying the Legend for an example that uses SYMBOL statements to label contour lines.
As with the options specified in the GOPTIONS statement, options specified with these global statements remain in effect until you change them or until you start a new SAS session.
For specific information on each of the global statements, see SAS/GRAPH Statements.
Using GOPTIONS to Specify Fonts |
The GOPTIONS statement has several options that can be used to specify fonts for your graphs.
FBY= sets the BY line font in your graphs.
FTEXT= sets the font for all the text in your graphs.
FTITLE= sets the font for the first title in your graphs.
For example, to specify Cumberland AMT for all of the text in your graphs, use
goptions ftext="Cumberland AMT";
Settings specified in the GOPTIONS statement remain in effect until you change them, until you specify reset=all , or until you close the SAS session.
If you want most or all of the text in your output to use a single font, specifying this font with the FTEXT= graphics option is frequently the best alternative. Using the FTEXT= option in the GOPTIONS statement instead of adding font specifications to several procedure action statements in addition to other global statements makes your code easier to maintain.
Note: The FBY= option is not supported by the Java or ActiveX devices. For specific information on the GOPTIONS statement, see GOPTIONS Statement. Information for specific graphics options is in Graphics Options and Device Parameters Dictionary.
Note: When you are sending SAS/GRAPH output to the HTML or RTF destinations (MARKUP destinations), titles and footnotes can be rendered as part of your graph image or as part of the HTML or RTF files. Where your titles and footnotes are rendered determines the fonts that are used for them. See Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output for information on the GTITLE and GFOOTNOTE destination options and the ODS USEGOPT statement.
Changing The Font Specifications Used By a Style |
There are three ways to change the font specifications used by a style. Which method you choose depends on how extensively you want to change the fonts used in your output.
You can modify the style element that controls a specific graph element such as graph titles or contour line labels.
You can modify the abstract font specifications in the GraphFonts class. These font specifications can be referenced in multiple places in a style and affect several graph elements.
You can modify the font settings in the SAS registry that the styles use to determine the default fonts. Changes to the SAS registry affect the fonts used by all styles that reference the SAS registry entry.
Modifying an existing style to use different fonts might be the best alternative if you need to create a style for all of your company's output. If you only want to change the fonts used in a few applications, then using the GOPTIONS statement is a better alternative.
For information on changing the font specifications used by the styles, see Ways to Modify Graph Fonts Or Colors Specified By Styles.
Precedence of Font Specifications |
When SAS/GRAPH is trying to determine the font to use for a specific graph element, it uses the first font that it finds from the following list.
Fonts specified on procedure action statement options such as the PLABEL= option in the PIE statement in the GCHART procedure.
Fonts specified on the AXIS, LEGEND, or SYMBOL statements.
Fonts specified with the GOPTIONS global statement.
Default fonts as described in Default Fonts
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.