Statistical Graphics Using ODS |
Creating an All-Color Style by Using the ModStyle Macro |
Many styles are designed to make color plots where lines, functions, and groups of observations can be distinguished even when the plot is sent to a black-and-white printer. Hence, lines differ not only in color but also in pattern. Similarly, markers differ in color and symbol.
You can change that behavior with the %MODSTYLE autocall macro. It creates a new style by modifying a parent style and reordering the colors, line patterns, and marker symbols in the GraphDatan style elements (see section Some Common Style Elements). By default, the macro creates a new style that distinguishes lines and groups only by color. The macro is documented in section Style Template Modification Macro.
The following example illustrates the default use of the macro and is taken from the section Fitting a Curve through a Scatter Plot of Chapter 91, The TRANSREG Procedure. The data come from an experiment in which nitrogen oxide emissions from a single cylinder engine are measured for various combinations of fuel and equivalence ratio. The following statements create the SAS data set:
data Gas; input Fuel :$8. EqRatio NOx @@; label EqRatio = 'Equivalence Ratio' NOx = 'Nitrogen Oxide Emissions'; datalines; Ethanol 0.907 3.741 Ethanol 0.761 2.295 Ethanol 1.108 1.498 ... more lines ... ;
The following statements fit separate curves for each group and produce Figure 21.24 and Figure 21.25:
ods listing style=statistical; ods graphics on; proc transreg data=Gas ss2 plots=transformation lprefix=0; model identity(nox) = class(Fuel / zero=none) * pbspline(EqRatio); run; %modstyle(parent=statistical, name=StatColor) ods listing style=StatColor; proc transreg data=Gas ss2 plots=transformation lprefix=0; model identity(nox) = class(Fuel / zero=none) * pbspline(EqRatio); run;
The first PROC TRANSREG step uses the STATISTICAL style to create the fit plot in Figure 21.24, which uses different colors, line patterns, and markers for each group. Then the macro creates a new style, called STATCOLOR, that inherits its characteristics from the STATISTICAL style. Only the attributes of the lines and markers are changed. In Figure 21.25, which is created with the modified style, the groups are differentiated only by color. This is the easiest and most common way for you to use this macro. However, you can use it to perform other style modifications as illustrated in the section Changing the Default Markers and Lines. The macro is documented in section Style Template Modification Macro.
Copyright © SAS Institute, Inc. All Rights Reserved.