Hi, (under 9.3.2)
The Template: Stat.Boxplot.Graphics.BoxPlotHorizontal is long and quite difficult to understand
So if my goal is to change only the color inside the boxes from the htmlblue defaut color to light red by example,
how can i determine which elements of style are involved into this task
I have observed that when i change the style from the default htmlblue to analysis
among the others changes ther is a box color change into light green.
now i need help hox to determine the elements ofr attributes
for the proc template
proc template;
define style boxG;
parent= styles.default;
class colors /.....?;
class GraphColors /.. ?..;
style GraphColors / | ||
'gcmiss' = cxa6a6a5 | ||
'gmiss' = cxc0c0bf | ||
'gablock' = cxFFFDF7 | ||
'gblock' = cxEEF4EE | ||
'gcclipping' = cxDC531F | ||
'gclipping' = cxE7774F | ||
'gcstars' = cx588458 | ||
'gstars' = cxB3D2B3 | ||
'gcruntest' = cxE7774F | ||
'gruntest' = cxE6E6CC | ||
'gccontrollim' = cxCCCC97 | ||
'gcontrollim' = cxFFFFE3 | ||
'gdata' = cxB3D2B3 | ||
'gcdata' = cx588458 | ||
'goutlier' = cx000000 | ||
'gcoutlier' = cx000000 | ||
'gfit2' = cxD18000 | ||
'gfit' = cx678D67 | ||
'gcfit2' = cxD18000 | ||
'gcfit' = cx678D67 | ||
'gconfidence2' = cxF5DAC1 | ||
'gconfidence' = cxDEDBC8 | ||
'gcconfidence2' = cx9F8777 | ||
'gcconfidence' = cxA5A18F | ||
'gpredict' = cx678D67 | ||
'gcpredict' = cx678D67 | ||
'gpredictlim' = cxEEEDE3 | ||
'gcpredictlim' = cxEEEDE3 | ||
'gerror' = cx000000 | ||
'gcerror' = cx000000 | ||
'ginsetheader' = colors('headerbg') | ||
'ginset' = colors('databg') | ||
'greferencelines' = cxA5A5A5 | ||
'gheader' = colors('docbg') | ||
'gconramp3cend' = cx3D793D | ||
'gconramp3cneutral' = cxC8C1AE | ||
'gconramp3cstart' = cxD18000 | ||
'gramp3cend' = cx6EA16E | ||
'gramp3cneutral' = cxB4CBAA | ||
'gramp3cstart' = colors('docbg') | ||
'gconramp2cend' = cxD18000 | ||
'gconramp2cstart' = cxFFFFD4 | ||
'gramp2cend' = cx6EA16E | ||
'gramp2cstart' = colors('docbg') | ||
'gtext' = cx000000 | ||
'glabel' = cx000000 | ||
'gborderlines' = cx4F493B | ||
'goutlines' = cx000000 | ||
'ggrid' = cxEFEDDD | ||
'gaxis' = cx4F493B | ||
'gshadow' = cxB4B4B4 | ||
'gfloor' = cxE4E4E4 | ||
'glegend' = cxFFFFFF | ||
'gwalls' = cxFFFFFF | ||
'gcdata12' = cx868686 | ||
'gdata12' = cxA4A4A3 | ||
'gcdata11' = cx746644 | ||
'gdata11' = cx8A7A53 | ||
'gcdata10' = cx699AA1 | ||
'gdata10' = cx98C7CE | ||
'gcdata9' = cxE6DA9E | ||
'gdata9' = cxFAEEAF | ||
'gcdata8' = cx6882A8 | ||
'gdata8' = cx8AA4C9 | ||
'gcdata7' = cxBEB794 | ||
'gdata7' = cxD9D2AD | ||
'gcdata6' = cxA5BDD7 | ||
'gdata6' = cxBDD5EF | ||
'gcdata5' = cx8E6C93 | ||
'gdata5' = cxA47DAA | ||
'gcdata4' = cxB3C54D | ||
'gdata4' = cxCBD786 | ||
'gcdata3' = cxA08A5D | ||
'gdata3' = cxB49C6A | ||
'gcdata2' = cxD18000 | ||
'gdata2' = cxF2AE49 | ||
'gcdata1' = cx678D67 | ||
'gdata1' = cx8FB38F; |
as there does not exist a tagset like style_popup usefull for the table elements override.
the following element have no color attribute but well a fill options?
class GraphBox / | ||
capstyle = "serif" | ||
connect = "mean" | ||
displayopts = "fill caps median mean outliers"; |
or is one of this element acting,
class GraphDataDefault / | ||
endcolor = GraphColors('gramp3cend') | ||
neutralcolor = GraphColors('gramp3cneutral') | ||
startcolor = GraphColors('gramp3cstart') | ||
markersize = 7px | ||
markersymbol = "circle" | ||
linethickness = 1px | ||
linestyle = 1 | ||
contrastcolor = GraphColors('gcdata') | ||
color = GraphColors('gdata'); | ||
class GraphData1 / | ||
markersymbol = "circle" | ||
linestyle = 1 | ||
contrastcolor = GraphColors('gcdata1') | ||
color = GraphColors('gdata1'); |
TIA
Andre
program for test
proc sort data=sashelp.class out=class;by sex;run;
ods pdf file="d:\notes\test\modifG1.pdf" style=analysis;
title; footnote;
proc boxplot data=class ;
plot height*sex / boxstyle=schematic horizontal;
inset min mean max stddev /
header = 'Boxplot avec Statistiques '
pos = tm;
run;
ods pdf close;
You will want to change the COLOR attribute inside of GRAPHDATADEFAULT to change the fill color. The CONTRASTCOLOR will change the outlines. The best way to handle this situation is to create a small style that inherits from the primary style that you are using. Switch to this style before the proc run, then switch back after the run. Here is an example:
proc template;
define style styles.boxstyle;
parent=styles.htmlblue;
style GraphDataDefault from GraphDataDefault /
color=cxff0000
;
end;
run;
ods html style=boxstyle;
proc sort data=sashelp.class out=class;by sex;run;
title; footnote;
proc boxplot data=class ;
plot height*sex / boxstyle=schematic horizontal;
inset min mean max stddev /
header = 'Boxplot avec Statistiques '
pos = tm;
run;
ods html style=htmlblue;
Look at the CBOXFILL option in the plot statement. You can assign an explict color to fill or a variable that contains the color for each record.
Or here's an example of changing the first 4 graphcolors and using inheritance from an existing style that may help.
proc template;
define Style immunizestyle;
parent = styles.meadow;
style GraphColors from Graphcolors /
'gdata4' = mediumblue
'gdata3' = yellow
'gdata2' = vivid_Green
'gdata1' = FireBrick
;
end;
run;
You will want to change the COLOR attribute inside of GRAPHDATADEFAULT to change the fill color. The CONTRASTCOLOR will change the outlines. The best way to handle this situation is to create a small style that inherits from the primary style that you are using. Switch to this style before the proc run, then switch back after the run. Here is an example:
proc template;
define style styles.boxstyle;
parent=styles.htmlblue;
style GraphDataDefault from GraphDataDefault /
color=cxff0000
;
end;
run;
ods html style=boxstyle;
proc sort data=sashelp.class out=class;by sex;run;
title; footnote;
proc boxplot data=class ;
plot height*sex / boxstyle=schematic horizontal;
inset min mean max stddev /
header = 'Boxplot avec Statistiques '
pos = tm;
run;
ods html style=htmlblue;
Thanks Dan
It was so obvious that i was going in other details missleaded by
the fact that the dataset has to be sorted before the boxplot could run normaly.
So i was inducted to try with graphdata1 and graphdata2 generaly linked to (sorted) group variable
in place of the graphdatadefault style element.
Using
class graphdatadefault /
allow inheritance and
is the same as
Style graphdatadefault from _self_ /
or
Style graphdatadefaut from graphdatadefault/
(reference Kevin Smith paper)
If there is any error in this assumption, please discuss so that i can rectify my knowledge.
TIA
Andre
Andre
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.