Ho Soha
You can also use the SG... procs to achieve the result, see example below. They allow to overlay plots with some settings for barwidth and discreteoffset you get two bar beside each other. With this example there is no need to change our data
DISCRETEOFFSET is supported with SAS 9.3 SGPLOT. You can turn off stat labels to remove the (Sum) suffix to the label in the legend. You can also creatively set bar width and discrete offsets to get an overlap effect or separate the bars completely.
title 'Sales by Region';
ods listing style=listing;
proc sgplot data=plotData cycleattrs;
hbar region / nostatlabel response=sales2009 discreteoffset=-0.2 barwidth=0.5;
hbar region / nostatlabel response=sales2010 discreteoffset=0.2 barwidth=0.5;
xaxis display=(nolabel);
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.