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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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