I can produce a stacked bar charts with GROUP and SUBGROUP in GPLOT (see the figure and the dataset attached).
legend1 label=(height=3 'Drop-out Reasons');
**pattern1 color=black value=e;
pattern1 color=black value=r4;
pattern2 color=red value=l4;
pattern3 color=blue value=x2;
axis1 label = (height =2 "TRT" justify=center) value=(height=2) ;
axis2 order=(0 to 100 by 10) label=(angle=90 height=2.5 "Percent of Drop-out (%)") ;
title1 "Figure 8.3. Stacked Bar Charts for the Distribution of Patient Drop-out Reasons by Treatment Group";
proc gchart data= dropout;
vbar trt / sumvar=pct subgroup=reason group=visit
MIDPOINTS= (1, 2, 3) width=8 space=0 gspace=6
maxis=axis1 raxis=axis2 legend=legend1;
format visit vstdf. reason rsndf. trt trtdf.;
label visit = "Visit";
run;
quit;
However in SGPLOT there is only GROUP and no SUBGROUP option, the below codes do not work.
proc sgplot data=dropout;
vbar visit / response = pct group=trt subgroup=reason ;
keylegend / position=bottom noborder;
xaxis label = "Drug";
yaxis VALUES= (0 to 100 by 10) label = "Percent of Drop-out (%)";
format visit vstdf. reason rsndf. trt trtdf.;
run;
quit;
Anyone know how to reproduce the same figure in SGPLOT?
Thanks,
Charlie
SGPLOT does not support CLUSTER and STACKED groups simultaneously. This feature may be added in a future release. However, you can create such a graph using the SGPANEL procedure. See blog article on this topic.
SGPLOT does not support CLUSTER and STACKED groups simultaneously. This feature may be added in a future release. However, you can create such a graph using the SGPANEL procedure. See blog article on this topic.
Thanks.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.