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