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;
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.
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.
Perfect; thank you Sanjay!
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.
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.
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.
Ready to level-up your skills? Choose your own adventure.