BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Leo9
Quartz | Level 8

Hi All,

 

I have data which looks something like table below. I need to create a bar plot where bars are grouped by cohorts. For example : Cohort 1 and then one bar for each of the timepoint (visitlbl) and then cohort 2 and then one bar for each of the timepoint again. I ran code below but just stacking cohort on top of each other. Any ideas ? 

 

proc sgplot data=xyz noborder;
vbarparm category=visitlbl response=avg /group = cohort datalabel /*group=cohort colorresponse=visitlbl*/;
xaxis display=(nolabel );
keylegend / noborder;

run;
title;

 

COHORTCONDITIONVISITLBLAvg 
14hPre-Dose0.9 
14hEnd of Infusion1.7 
14h1h-Post Infusion1.9 
14hD20.7 
14hD30.9 
24hPre-Dose0.9 
24hEnd of Infusion2.1 
24h1h-Post Infusion3.2 
24hD20.7 
24hD30.9 
     
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Set GROUPDISPLAY option to CLUSTER - the default is stacked. This is an option on the VBARPARM statement.

vbarparm category=visitlbl response=avg /group = cohort datalabel groupdisplay = cluster /*group=cohort colorresponse=visitlbl*/;

View solution in original post

2 REPLIES 2
Reeza
Super User
Set GROUPDISPLAY option to CLUSTER - the default is stacked. This is an option on the VBARPARM statement.

vbarparm category=visitlbl response=avg /group = cohort datalabel groupdisplay = cluster /*group=cohort colorresponse=visitlbl*/;
Leo9
Quartz | Level 8

Thank Reeza

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 359 views
  • 1 like
  • 2 in conversation