Hi:
The easiest way to change the bar colors is to use a modified style template. The style attribute values GDATA1-GDATA12 set the colors for grouped data. The program below does a very simple bar chart in the template and then shows the default colors from the LISTING style and then the new colors from the CARCOLORS style template.
The STYLE= option on the ODS invocation statement will be the appropriate place to change the style used for the SGRENDER...so for example:
[pre]
ods listing style=styles.carcolors;
** sgrender step;
OR
ods html file=... style=styles.carcolors;
** sgrender step;
ods html close;
OR
ods rtf file=... style=styles.carcolors;
** sgrender step;
ods rtf close;
[/pre]
Some good papers on style template usage in SAS 9.2 with a few graph examples are:
http://support.sas.com/resources/papers/proceedings10/033-2010.pdf
http://support.sas.com/resources/papers/proceedings09/227-2009.pdf
cynthia
[pre]
data carsum;
infile datalines;
input Type $ Count Sum_Weight;
return;
datalines;
Hybrid 3 7472
SUV 60 266666
Sedan 262 890555
Sports 49 161489
Truck 24 102018
Wagon 30 103164
;
run;
ods path work.tmp(update) sasuser.templat(update) sashelp.tmplmst(read);
proc template;
define statgraph carplot;
mvar _mytitle_;
begingraph;
EntryTitle _mytitle_ /;
layout overlay / xaxisopts=(type=Discrete );
BarChartParm X=Type Y=Sum_Weight /
primary=true
Group=Type
LegendLabel="Weight (LBS)" NAME="VBAR";
DiscreteLegend "VBAR"/ title="Type";
endlayout;
endgraph;
end;
run;
%let _mytitle_ = The Default Style for ODS LISTING;
proc sgrender data=carsum template=carplot;
run;
** now make a new style template;
proc template;
define style styles.carcolors;
parent=styles.listing;
class GraphColors /
'gdata1'=green
'gdata2'=red
'gdata3'=cyan
'gdata4'=pink
'gdata5'=yellow
'gdata6'=purple;
end;
run;
ods listing style=styles.carcolors;
%let _mytitle_ = The Changed Style Template;
proc sgrender data=carsum template=carplot;
run;
[/pre]