BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
CLiu
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

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.

View solution in original post

2 REPLIES 2
Jay54
Meteorite | Level 14

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 5248 views
  • 0 likes
  • 2 in conversation