Hello,
I'm currently trying to find a way to customize colors in a stacked bar chart. The colors are currently blue/red.
Here is an example of my code:
proc sort data=t.indic_f;
by A;
run;
proc freq data=t.indic_f noprint;
table RETARD_PAT/out=test3;
by A;
run;
proc sgplot data=test3;
vbar A / response=Percent group=RETARD_PAT groupdisplay=stack;
xaxis discreteorder=data;
yaxis grid values=(0 to 100 by 10) label="Percentage of Total with Group";
format RETARD_PAT retards.;
run;
I've done a lot of research to no avail... Thanks!lot
You should post it at GRAPH forum ,not this forum .
And include the version of SAS used as options have been added with later releases.
A good idea for a sticky this. If your having any graph issues or need some examples on things, search this extremely helpful blog:
http://blogs.sas.com/content/graphicallyspeaking/
Pretty much everything you can imagine is covered, normally with sgplot and template examples. In your case you might get away with %modstyle() macro call:
If you have SAS 9.3 or greater, you can create an attributes map to assign attributes (including color) to specific group values. If you do not care about specifically assigning colors, and you have SAS 9.4 or greater, you can use the DATACOLORS option on the new STYLEATTRS statement to control those colors without modifying the ODS style. Modifying the ODS style is always an option in any release.
Hope this helps!
Dan
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: