BookmarkSubscribeRSS Feed
hugues_pellerin
Calcite | Level 5

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

4 REPLIES 4
Ksharp
Super User

You should post it at GRAPH forum ,not this forum .

ballardw
Super User

And include the version of SAS used as options have been added with later releases.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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:

SAS/STAT(R) 9.22 User's Guide

DanH_sas
SAS Super FREQ

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2183 views
  • 0 likes
  • 5 in conversation