| Overview |
When any graphics template is executed, there is always an ODS style in effect that governs the appearance of the output. The following ODS statement sends grapics output to the RTF output destination using the LISTING style:
ods rtf style=listing;
ods graphics on / height=175px width=200px border=off;
proc sgrender data=sashelp.class
template=scatter;
run;
ods graphics off;
ods rtf close;
Support for ODS styles is highly integrated into GTL syntax. By default, the graphical appearance features of most plot and text statements are mapped to corresponding style elements and associated attributes. Because of this, your output tables and graphs always have a reasonable overall appearance.
Figure 1.6, Figure 1.7, and Figure 1.8 show how a graph's appearance can be changed by using references to style elements to set the graph's appearance options. Nearly all supplied GTL templates use this technique because it permits changes in graph appearance by style modification instead of graphical template modification. The graphs in the figure are generated with the following GTL statement:
contourplotparm x=x y=y z=density / contourtype=fill nhint=9 colormodel=ThreeColorLowHigh ;
The following style template shows the definition for the ThreeColorLowHigh style element:
style ThreeColorLowHigh /
endcolor = GraphColors("gramp3cend")
neutralcolor = GraphColors("gramp3cneutral")
startcolor = GraphColors("gramp3cstart");
![]() |
![]() |
![]() |
Figure 1.8: Style=Journal
Styles minimally contain information about fonts, colors, lines, and markers for various parts of the graph. The following example assigns the supplied JOURNAL style to a graph. The JOURNAL style uses filled non-outlined bands, a frame around the axes, outside axis ticks, and a circle for the default marker.
proc template;
define statgraph styledemo;
dynamic TEXT;
begingraph;
entrytitle TEXT;
layout overlay;
modelband "p" / curvelabelupper="95% UCL"
curvelabellower="95% LCL";
scatterplot x=height y=weight;
regressionplot x=height y=weight /
cli="p" alpha=.05;
endlayout;
endgraph;
end;
run;
![]() |
The following example shows how a new style named MYJOURNAL can be defined using JOURNAL style as a parent template and then modifying the appearance of the graph band, walls, axis lines, and marker symbols:
proc template;
define style Styles.MyJournal;
parent = styles.Journal;
style GraphBand from GraphGraphBand /
displayopts = "outline" ;
style GraphWalls from GraphWalls /
frameborder = off ;
style GraphAxisLines from GraphAxisLines /
tickdisplay = "across" ;
style GraphGridLines from GraphGridLines /
displayopts = "on" ;
style GraphDataDefault from GraphDataDefault /
markersymbol="plus";
end;
run;
![]() |
Of course, appearance changes made to any style can be made with plot statement options in the GTL, but if appearance consistency is an issue across graphs, it makes more sense to customize a style definition.
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.