BookmarkSubscribeRSS Feed
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="";


to produce  the following figure




but would like to make something more like the following:




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



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. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation