BookmarkSubscribeRSS Feed
Whitlea
Obsidian | Level 7

SAS base 9.4

I want to make a grouped bar chart using sgplot vbarparm that looks like the one attached (see attachment) but with error bars. Does anyone have code for this?  My main goal is to get multiple variables on the x axis and display their different levels without having to have a legend. Thank you!

  This is the code I have created for a different bar chart, feel free to make modifications to it in order to create the desired bar chart.

proc sgplot data=state noborder ;

format percent f8.1

state state.;

where state>0 and percent>0;

 

STYLEATTRS DATACOLORS=(cxcccccc cx99CCFF cx99CCFF cx99CCFF cx99CCFF cx99CCFF cx99CCFF);

vbarparm category=state response=percent / group=state groupdisplay=cluster

 

barwidth=0.8 nooutline;

xaxis display=(nolabel noticks noline )

VALUEATTRS=(size=9 );

yaxis label='Percent' grid values=(0 to 50 by 10) display=(noticks noline)

VALUEATTRS=(size=9 );

run;

1 REPLY 1
DanH_sas
SAS Super FREQ

Just use the LIMITUPPER and LIMITLOWER options to point at the columns that contain your limit values.

 

Hope this helps!

Dan

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