06-28-2018 12:42 AM
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
06-28-2018 04:17 AM
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:
And please avoid coding all in uppercase, it really makes code hard to read.