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

I need to create a plot that uses a bar to represent a range.  I am trying to do this using the HBAR statement in sgplot.

 

For example, I need the maximum value of the bar to be 5.1 and the minimum value of the bar to be 4.45.

When I generate the plot using these specs, the maximum value is 5.1, but the minimum value is 0.

If I specify a negative number for the minimum, then it works and the minimum value of the bar is the minimum value that I specified.

 

Is there an option that I need to specify that will allow me to craeate a bar with a minmum value greater than zero?

Code below and example output attached.

 

Thank you.

 

data quant;

analyte = 'entry';

pct_5 = 4.45;

pct_95 = 5.1;

run; quit;

ODS LISTING STYLE=ceafigstyle GPATH = 'C:\ILSI.Publication' IMAGE_DPI=500;

ods graphics / reset width=600px height=400px imagefmt=png;

proc sgplot data=quant noautolegend;

 

vbar analyte / response=pct_5

fillattrs= (color = bigb) transparency=0

legendlabel="lit_min" name="lit_min" ;

 

vbar analyte / response=pct_95

fillattrs= (color = bigb) transparency=0

legendlabel="lit_max" name="lit_max" ;

 

xaxis display=(nolabel);

yaxis display=(nolabel) discreteorder=data;

run;


hbar.JPG
1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

Use HIGHLOW plot statement with TYPE=BAR.

You can make is horizontal or vertical by using Y= or X= role with the LOW and HIGH roles.

View solution in original post

3 REPLIES 3
Jay54
Meteorite | Level 14

Use HIGHLOW plot statement with TYPE=BAR.

You can make is horizontal or vertical by using Y= or X= role with the LOW and HIGH roles.

fastb
Fluorite | Level 6

Perfect; thank you Sanjay!

Jay54
Meteorite | Level 14

Note:  HIGHLOW bar does not summarize the response values for the same category (or gategory+group).  If multiple observations are found with same category (or gategory+group), each observation is drawn independently.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 3 replies
  • 1501 views
  • 0 likes
  • 2 in conversation