My thought was to get the AXIS under control first and then to work with getting the groups colored based on an understanding of how the AXIS worked. FILLATTRS would not be the way I would try to impact the colors for groups. I use FILLATTRS for ungrouped data.
Grouped fills are automatically colored in the SG procedures based on style attributes in the style template, as described here:
http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003136924.htm (see the section where it describes GraphData1-GraphData12)
http://support.sas.com/documentation/cdl/en/grstatug/62464/HTML/default/p18c2hn0ybnntyn1t6aitke3f0l6...
If you look at the description of FILLATTRS for VBAR in SGPLOT:
http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/vbar-stmt.htm where it says:
FILLATTRS= style-element | (COLOR= color)
specifies the appearance of the fill for the bars. You can specify the color of the fill by using a style element or by using the COLOR= suboption. For more information about specifying colors, see SAS/GRAPH Colors and Images in the SAS/GRAPH: Reference.
Note: This option has no effect if you specify the NOFILL option.
Default: For ungrouped data, the default color is specified by the Color attribute of the GraphDataDefault style element in the current style.
For grouped data, the default color is specified by the Color attribute of the GraphData1... GraphDatan style elements in the current style.
But, if you use FILLATTRS with GROUP=, then the FILLATTRS color will be used for ALL the groups, so FILLATTRS is mostly useful for ungrouped data.
I don't normally see any confusion with the SG procedures on the coloring of groups, so I wasn't sure what other code was in effect or what the data looked like to cause the original poster's issues with the groups. However, I figured that getting AXIS under control might cause his group issue to fix itself.
For example, if I want the first BP_STATUS to always be PINK, then I change the 'gdata1' attribute to be PINK. On the other hand, if I want the first BP_STATUS to always be PURPLE, then I change the GDATA1 attribute to PURPLE. In the code below, I'm changing GDATA1 to be PINK. No matter what set of options I run for the XAXIS, the first BP_STATUS is always PINK.
cynthia
[pre]
ods path work.temp(update)
sashelp.tmplmst(read);
proc template;
define style styles.grp;
parent=styles.analysis;
class GraphColors /
'gdata1' = pink
'gdata2' = purple
'gdata3' = lavender;
end;
run;
** 1) Sort by bp_status and cholesterol ;
proc sort data=sashelp.heart out=heart;
by bp_status cholesterol;
run;
ods listing style=styles.grp;
proc sgplot data = heart;
title '1) PINK for first bp_status';
vbar cholesterol /group=bp_status;
xaxis discreteorder=data;
format cholesterol newchol.;
run;
** 2) Sort by cholesterol & use format and discreteorder=data;
** so LOW will be first;
proc sort data=sashelp.heart out=heart;
by descending bp_status cholesterol;
run;
ods listing style=styles.grp;
proc sgplot data = heart;
title '2) Still pink for first bp_status';
vbar cholesterol /group=bp_status;
xaxis discreteorder=data;
format cholesterol newchol.;
run;
** 3) Sort by cholesterol & use format and discreteorder=formatted;
** so LOW will be first;
ods listing style=styles.grp;
proc sgplot data = heart;
title '3) All Groups still the same';
vbar cholesterol /group=bp_status;
xaxis discreteorder=formatted;
format cholesterol newchol.;
run;
** 4) Sort by cholesterol & use format and discreteorder=unformatted;
** so LOW will be first;
ods listing style=styles.grp;
proc sgplot data = heart;
title '4) All Groups still the same';
vbar cholesterol /group=bp_status;
xaxis discreteorder=unformatted;
format cholesterol newchol.;
run;
[/pre]