BookmarkSubscribeRSS Feed
mahendraksas
Calcite | Level 5

Hello all,

 

I am trying to create a clustered bar chart by patient grouped by treatment and then by patients internally at each timepoint. Below is my code. But despite of numerous combinations using grouporder=ascending or data the bars won't stack up by treatment (trtp2) first. Rather they are ordered by usubjid. I tried sorting by trtp2 alone without other variables also. Is there anything wrong that I am doing ?

 

proc sort data= mo out=mo2 ;
by atptn trtp2 usubjid ;
run;

 

proc sgpanel data=mo2 ;
panelby atptn / layout=columnlattice onepanel noborder colheaderpos=bottom novarname ;
vbar usubjid / response=aval group=trtp2
groupdisplay=cluster CLUSTERWIDTH= 1 grouporder=data;
colaxis display=(nolabel noticks );
rowaxis label=' ' grid offsetmax=0.025 ;
keylegend/ title="";
run;

1 REPLY 1
ed_sas_member
Meteorite | Level 14

Hi @mahendraksas 

 

Does this adaptation meet your expectations?

Could you please clarify how the graphic would look like?

proc sort data=mo out=mo2;
	by atptn trtp2 usubjid;
run;

proc sgpanel data=mo2;
	panelby atptn / layout=columnlattice onepanel noborder colheaderpos=bottom 
		novarname;
	vbar trtp2 / response=aval group=usubjid groupdisplay=stack CLUSTERWIDTH=1 
		grouporder=data;
	colaxis display=(nolabel noticks);
	rowaxis label=' ' grid offsetmax=0.025;
	keylegend/ title="";
run;

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 664 views
  • 0 likes
  • 2 in conversation