Hello Everybody,
Reeza showed me to a custom style template that follows Stephen Few's visualization practices. I'm trying to use that to create a custom style template for my organization (attached). For the most part it seems to be doing what I want except for this:
When I run this code, all my custom chart colors show up in the bars:
ods html style=Styles.My_Custom_Style;
title 'Counts by Type';
proc sgplot data=sashelp.cars;
vbar type/ group=type;
run;
but when I run this:
ods html style=Styles.HACustom;
title 'Counts by Type';
proc sgplot data=sashelp.cars;
vbar type;
run;
the bar fill seems to be a default light blue. How can I get it to use my custom colors?
Thanks,
Brian
When you do not have a GROUP on VBAR statement, the default color for the bars is retrieved from the GraphDataDefault style element, not GraphData1-N. If you want to use one of the GraphData1-N colors, the simplest way is to do the following:
vbar type / fillattrs=GraphData1;
Hope this helps!
Dan
When you do not have a GROUP on VBAR statement, the default color for the bars is retrieved from the GraphDataDefault style element, not GraphData1-N. If you want to use one of the GraphData1-N colors, the simplest way is to do the following:
vbar type / fillattrs=GraphData1;
Hope this helps!
Dan
Thanks again Dan!
Dan,
Maybe I should post this in a new thread but I was wondering why when I run the code below
ods html style=Styles.My_Custom_Style;
proc sgplot data=aviator.aviator_demogs nocycleattrs;
histogram age_f18 / fillattrs=GraphData1 name='s' binstart=20 binwidth=2 transparency=0.5;
density age_f18 /type=kernel ;
histogram age_T45 / fillattrs=GraphData2 name='d' binstart=20 binwidth=2 transparency=0.5;
density age_T45 /type=kernel ;
keylegend 's' 'd' / location=inside position=topright across=1 noborder ;
yaxis offsetmin=0 ;
xaxis label="AGE" ;
run;
and then I run this code
proc npar1way data=aviator.Demog_vitals wilcoxon median
plots=(wilcoxonboxplot medianplot);
class AIRCRAFT;
var AGE;
run;
the wilcoxonboxplot and medianplot seem to have the same transparency setting as the SGPlot output. Is there a way to override this?
The SGPLOT code has no effect on the NPAR1WAY run. Run the NPAR1WAY by itself, and you should get the same result. You will need to check the template(s) use by that procedures and adjust them if you need to modify the output.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.