I tried to follow it but since the actual data set has many months to display (20+) and that it might be because of months as the type of data, I get this error:
WARNING: The intervals on the axis labeled "month" are not evenly spaced. ERROR: The bottom horizontal axis labeled "month" could not be fit. There was not enough room in the graph's display area to fit the group axis.
On top of that, since the example had only two groups, and mine has many, I wasn't sure how to edit the code to draw the table/fill in the lines.
I tried a different method and can get something kind of close, but am wondering if there was a way to use proc gchart, and to add goal lines/text labels.
proc transpose data=testg
var Total visit1-visit8;
proc sgplot data=long1;
xaxistable value /x=value class=type colorgroup=type;
vbar month / response=value group=type stat=sum;
I can guarantee that GCHART will be much harder to work with.
The fit of your axis labels could be addressed by use of a different format for if the Month variable is an actual date value which seems likely. The note about uneven spaces is because months are not the same length so you can pretty much ignore that. The SAS YYMON6. format will display values as a 2-digit year followed by month abbreviation. If you want to force the appearance of a - then a custom format.
proc format library=work;
picture yy_MON (default=7)
low - high = '%y-%b' (datatype=date)
put x yy_mon.;
Xaxis option splitchar of fitpolicy with split while using the above custom format to split text on the - may help a bit.
If your users know each bar should represent a month then THIN option reducing the text for some ticks may be appropriate.
Reducing the size of the font for the axis may help as well as increasing the size of the display area for the graph.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.