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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.