SAS Programming

DATA Step, Macro, Functions and more
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!

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