Hi All,
I have created a stacked bar graph and I need to change the colours of the bars after the 25th June 2018.
This is the code I use to create the chart.
PROC SGPLOT data=work.MERGETEST noborder;
Title "Test";
VBAR EVENT_DT / RESPONSE=COUNT GROUP=CONTACT;
yaxis display=(noline noticks) grid values=(0 to 100000 by 1000) offsetmin=0
label='Count' ;
inset 'Change started on the 25 June 2018' / position= topright border;
RUN;
I have used the following to change the fill colour in a single bar
Data Attrmap;
Retain id "myid";
input value $ fillcolor $8.;
datalines;
0 VIBG
1 BIBG
;
run;
and use dattrmap=attrmap attrid=myid in the SGPLOT.
How do I now change it to colour the stacked bar chart
Cheers
Dean
Can you not do two plots with overlay? I.e. plot all values < 25jun and give those a style color, then plot all values > 25jun and give those a style color different to the first? That would be the quickest way I can think of. The other way would be to use groups. So in your data assign < 25jun as group1, > 25jun as group 2, then use the group= options in the plot. The best reference for graphing is here:
http://blogs.sas.com/content/graphicallyspeaking/
And please avoid coding all in uppercase, it really makes code hard to read.
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.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.