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

I am seeking a reference that will help me create what I believe is called a "positive-negative" bar chart (although I'm not sure). Here's an example visual I found on the web at http://beatexcel.com/positive-negative-bar-chart/ .

Rodcjones_0-1615989960500.png

In the SAS documentation I found this reference (specifically the BASELINEINTERCEPT statement) https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=grstatgraph&docsetTarget=... 

But this is not helpful to me because I prefer/need to do SGPLOT or other SAS Graphics procedures rather than this if possible.

 

This is a sample dataset I'm trying to graph in this way.


data have;
input day $ value ;
datalines;
Wednesday 1.13203258
Tuesday 1.055489878
Thursday 0.050301811
Monday -0.145520643
Saturday -0.281669589
Sunday -0.281669589
Friday -1.360262415
;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Basic HBAR for the data shown:

proc sgplot data=have;
   hbar day /response=value;
run;
   

And possible order control using the categoryorder option.

proc sgplot data=have;
   hbar day /response=value 
            categoryorder=respdesc;
run;

View solution in original post

2 REPLIES 2
ballardw
Super User

Basic HBAR for the data shown:

proc sgplot data=have;
   hbar day /response=value;
run;
   

And possible order control using the categoryorder option.

proc sgplot data=have;
   hbar day /response=value 
            categoryorder=respdesc;
run;
Rodcjones
Obsidian | Level 7
Simple, elegant and perfect solution - thank you!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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