Hello,
I am trying to add a vertical border between bars for q1 and q2 so that the bars for q1 are set off from the other grouped bars. If my x-axis were continuous, I would just use the REFLINE statement, but how do I do this when my x-axis is discrete? I want the line to extend the length of the y-axis. Thank you!
data have;
input year $ var $ value lowerci upperci;
cards;
2018 q1 3.4 3.2 3.6
2019 q1 3.9 3.8 4.0
2018 q2 2.1 2.0 2.2
2019 q2 3.0 2.8 3.2
2018 q3 1.8 1.5 2.1
2019 q3 1.4 1.3 1.5
;
run;
proc sgplot data=have;
vbarparm category=var response=value/ group=year limitlower=lowerci groupdisplay=cluster limitupper=upperci barwidth=.6 tip=(value) ;
yaxis min=0 max=4 minor values= (0 to 4 by .5) grid label="Strongly disagree : Strongly agree";
xaxis label = ' ';
run;
Not the slickest but:
proc format library=work;
value $q
'q1.5' = ' '
other = [$2.]
;
run;
proc sgplot data=have;
vbarparm category=var response=value/ group=year limitlower=lowerci groupdisplay=cluster
limitupper=upperci barwidth=.6 tip=(value);
refline 'q1.5' /axis=x ;
yaxis min=0 max=4 minor values= (0 to 4 by .5) grid label="Strongly disagree : Strongly agree";
xaxis label = ' ' values=('q1' 'q1.5' 'q2' 'q3') valuesformat=$q.;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.