BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Felix_
Obsidian | Level 7

Hi Communitie,

I build now for a couple of hours the necessary data and graphic --> i am almost confident EXCEPT of the overlapping Barlabels (see attached pictures)

 

barlabels.PNG

The code is following:

PROC SGPLOT DATA= section_1_2;
  VBAR month / RESPONSE= count1 DATALABEL LEGENDLABEL = "Fiscal year &fiscalyear2.";
  VBAR month / RESPONSE= count2 DATALABEL barwidth=0.5 transparency=0.4  LEGENDLABEL = "Fiscal year &fiscalyear1.";
  YAXIS VALUES= &yaxis OFFSETMIN= 0 LABEL= "Number of Follow-ups";
  XAXIS LABEL= "Month" DISCRETEORDER=DATA ;
RUN;

 

I did previously some GTL stuff for other projects....but i dont have an idea how to solve this overlapping problem.

 

...Maybe i am lacking of creativity --> does someone has a solution?

 

Best regards & thanks in advance,

Felix S.

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

Well, you have two bars with bar labels.  So, if the values are close, the labels will overlap.  There are multiple solutions:

 

If your data is presummarized (does not have multiple observations for same month), you could move one of the labels to the bottom of the bar.  If you have SAS 9.40M3, use VBARPARM to display the summarized bars, and overlay a TEXT plot to display the label at the bottom (y=0).  If earlier version, use SCATTER with MARKERCHAR.  Just create a variable y=0 in the data and use that with the scatter or text plot.  Use appropriate color.

 

Or, you can use a XAXISTABLE to put both bar values under the bars.

View solution in original post

2 REPLIES 2
Jay54
Meteorite | Level 14

Well, you have two bars with bar labels.  So, if the values are close, the labels will overlap.  There are multiple solutions:

 

If your data is presummarized (does not have multiple observations for same month), you could move one of the labels to the bottom of the bar.  If you have SAS 9.40M3, use VBARPARM to display the summarized bars, and overlay a TEXT plot to display the label at the bottom (y=0).  If earlier version, use SCATTER with MARKERCHAR.  Just create a variable y=0 in the data and use that with the scatter or text plot.  Use appropriate color.

 

Or, you can use a XAXISTABLE to put both bar values under the bars.

Felix_
Obsidian | Level 7
Hello Sanjay,
Thank you for your quick Response and suggestions. I will try the Options soon !

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 3107 views
  • 1 like
  • 2 in conversation