In some cases it is important to have
a specific visual effect, but it is not necessary for the plot to
be reused with different styles. In such a case, you can specify hardcoded
values for the visual attributes in the appearance option.
For example, you could
use the following statement to set the density curve attributes:
density height / lineattrs=(pattern=dashdashdot color=red);
Using Hardcoded Values
|
ods graphics / width=4in;
proc sgplot data=sashelp.class
noautolegend;
histogram height;
density height /
lineattrs=(pattern=dashdashdot color=red);
run;
|
The result is a red
density curve with a DashDashDot pattern.
In general, it is recommended
that you specify the style element rather than hardcoded values. Style
elements are designed to derive all of the relevant visual attributes
from the applied style. When you specify a hardcoded value for the
line color, as in this example, the color is no longer derived from
the specified style element. If you later change the style that is
applied to the graph, the hardcoded attribute might conflict with
the new style. Also, a hardcoded color could be exactly the same color
as the wall color of another style, and become indistinguishable from
the wall.
For example, if you
change the overall style to Journal, which only uses gray-scale colors,
the color for the curve is still red. This result might not be desirable.
Hardcoded Attributes When the Journal Style Is Applied to the
Graph
|
ods html style=journal;
proc sgplot data=sashelp.class
noautolegend;
histogram height;
density height /
lineattrs=(pattern=dashdashdot color=red);
run;
ods html style=htmlblue;
|
You use a standard syntax
to hardcode colors, line thickness, line patterns, and marker symbols.
For more information
about this syntax, see the following topics: