BookmarkSubscribeRSS Feed
faithelyse
Calcite | Level 5

My goal:

Produce a stacked bar chart by frequency of a variable that lists the decrease or increase of each group from the previous bar.

I have done this with a regular bar chart by overlaying a bubbleplot in Proc Template with transparent bubbles that labels the data point with my increase/decrease variable value; this is displayed in the "Bar Chart" image attached. Now, I need to do the same thing, only for a stacked bar chart, which is proving difficult. I have attached a second image, "Stacked Bar Chart," where I have manually added the values to illustrate what I am trying to accomplish.

Does anybody have an idea of how I would approach this?


Stacked Bar Chart.pngBar Chart.png
2 REPLIES 2
Jay54
Meteorite | Level 14

This can be tricky as the (stacked) group bar chart is summarizing the data, and you don't know where to place the labels.  One way would be to summarize the data yourself and precompute the low and high (and middle) of each bar segment in your data step.  Put the delta values in another column.  Then, use the HIGHLOW plot to draw the bars and use an overlaid scatter with MarkerChar to draw the delta values in the middle location.

faithelyse
Calcite | Level 5

Thank you, Sanjay; I will try this now.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1158 views
  • 1 like
  • 2 in conversation