BookmarkSubscribeRSS Feed
akaranevich
Calcite | Level 5

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

 

SGPanel60.png

 

but would like to make something more like the following:

 

image.png

 

 
1 REPLY 1
ballardw
Super User

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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 839 views
  • 0 likes
  • 2 in conversation