Hi, I would like to add arrows to show "improved/worsened" in the waterfall plot output like the screenshot below. The separation point of the red/green arrows is based on the y-axis line 0.0. I can use annotation to get it shown from PROC SGPLOT on the first page (the SAS code is provided). However, because the program will generate multiple pages, each page represents a different item with different y-axis range. The position of 0.0 line on each page will change/shift, therefore a fixed position of the arrows (from the annotation below) won't work. Would you please provide some suggestions/solutions on this issue to help me get this resolved? Many thanks. (or is there a way to display these red/green arrows inside the plot and does not mess up the plot itself?)
...
Without actual data, or a much clearer description of how all your different graphs will vary, it is not going to be possible to provide code.
If this were my project I think I would investigate adding data to the plot data set(s) to create VECTOR plots for the arrows. Since this would move the arrows into the graph area you would need to set xaxis options to include your current range of values plus a bit to set the xorigin for the vectors. Your yorigin would be a small offset positive and negative from 0 and set the x, y coordinates for the pair for each plot to be in the range. Whether one vector with a Group option would work better than two vector plots hard to tell.
A TEXT plot code provide the text to go with the vectors
The key for doing what you requested is to use different drawing spaces. You should set the drawing space for the Y coordinate you want to zero to be Y1SPACE="DATAVALUE" and Y1=0. That way, the arrows will follow the zero tick on the Y-axis regardless of where it is drawn. The other coordinates can be drawn in other drawing spaces. For your use case, I would tend to set X1SPACE and X2SPACE to be WALLPERCENT, and set X1 and X1 to be values greater than 100. That way, the arrows are drawn outside of the wall at a consistent distance from the wall, regardless of graph size.
Hope this helps!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.