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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1145 views
  • 0 likes
  • 2 in conversation