I am trying to produce a 2x2 set of bar plots that has either the axis labels both on top and bottom, or in-between the two rows of plots. I am using SGPanel, and can't seem to find a way to move the axis which labels the individual bars anywhere. I would rather not use a colored legend because some of the groups have extremely low counts, and I want them to all be on the same y-scale.
I'm currently using the following code
proc sgpanel data=freqmed (where=(dx ^=""));
title "Medications taken at baseline";
format tablenum tablenum.;
panelby dx / novarname ;
rowaxis label="Baseline totals";
colaxis grid label=" ";
vbar Tablenum / response=Frequency group=tablenum dataskin=sheen nostatlabel;
keylegend "doesn't matter what's here it's invisible!" / title="";
run;
to produce the following figure
but would like to make something more like the following:
I think this would be possible by
1) suppressing the actual tick labels of the xaxis and
2) adding y values to your data with the text you want to display near the top of the panel using a text plot for the groups displayed in the bottom two panels (DX = Other and PLS).
You would likely get to experiment with the ROTATE option to get best appearance
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.