I have the following code, with a vbarparm and a scatterplot. If I remove the scatterplot, I get a nice graph with no extra lines; just the border around the graph. If I uncomment the scatterplot, that works, except now I have an extra line - presumably some padding between pre-existing lines. The bars now come from an origin line that is some distance above the box around the graph.
Is there any way to remove that line and/or padding? I'm not entirely sure why it exists in the first place. I do want the bars to originate from the bottom of the box line, not to originate from a nonexistent x axis line.
The general concept here is that I'm placing stat test results over the bars, and since I'm using groupdisplay=cluster I cannot use datalabel; so scatter with a position of 105 seemed most reasonable as a solution. I'd be happy to consider other solutions if there is a better way to do this.
length stub $15;
Facility Favorable 65
Facility Neutral 25
Facility Unfavorable 10
Region Favorable 75
Region Neutral 15
Region Unfavorable 10
Nation Favorable 55
Nation Neutral 25
Nation Unfavorable 20
define statgraph mybarplot;
layout overlay /
xaxisopts=( display=( tickvalues )
TickValueAttrs=( Size=8pt Family="Arial/Bold")
type=discrete discreteopts=( TickValueFitPolicy=SplitRotate sortOrder=data ) )
yaxisopts=( display=none labelFitPolicy=Split type=auto )
BarChartParm X=installation Y=prop / primary=true Group=stub
DataLabelAttrs=( Color=CX000000 Family="ARIAL" Size=8 Weight=bold ) Display=( Fill )
barwidth=0.4 LegendLabel="Range" NAME="Facility" groupdisplay=stack
scatterplot x=installation y=top / xaxis=X primary=false markercharacter= statresult;
DiscreteLegend "Facility" / Location=Outside valign=bottom Title=" ";
proc sgrender data=mydata template=mybarplot;
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.
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.