BookmarkSubscribeRSS Feed
ace2011
Calcite | Level 5
Guys -

If i have a Graph with values say;

a
60
70
60
100
120
110


I plot these on a bar graph with a on the Y Axis - is there a way i can format the axis to show the minimum at 40?

IS this possible at all?
3 REPLIES 3
GraphGuy
Meteorite | Level 14
By default, gchart included zero in the response axis, and it is generally the "best practice" to do that.

SAS does provide a way to over-ride the default with an axis statement (but make sure this is really/really/really sure this is what you want to do, and is a good way to display your data, before doing it!)


data foo;
barnum=_n_;
input a;
datalines;
60
70
60
100
120
110
;
run;

axis1 order=(40 to 150 by 10);
proc gchart data=foo;
vbar barnum / discrete
type=sum sumvar=a raxis=axis1;
run;
DanH_sas
SAS Super FREQ
Just in case your using SGPLOT for this, I modified Robert's example to show you how you would do it.

[pre]
data foo;
barnum=_n_;
input a;
datalines;
60
70
60
100
120
110
;
run;

proc sgplot data=foo;
yaxis min=40;
vbar barnum / response=a;
run;
[/pre]
Bill
Quartz | Level 8
Ace:

Rob is letting you off easy with respect to the bar chart not startng at zero. Here's why it must start at zero:

Bar Chart Value Axis Scale Must Include Zero
by Jon Peltier
Wednesday, March 30th, 2011
Peltier Technical Services, Inc., Copyright © 2011.
Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

http://peltiertech.com/WordPress/bar-chart-value-axis-scale-must-include-zero/#ixzz1OF1FUIkt.

Remember the cardinal rule about bar charts and axis scales? Because we judge the values in a bar chart by the lengths of the bars, not by the positions of the ends of the bars, the axis scale must include zero. By chopping off the bottoms of the bars, we increase the resolution of the chart, but we distort the apparent values encoded by the bars. I’ll repeat: The value axis of a bar chart must include the value zero.

Bill

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1202 views
  • 0 likes
  • 4 in conversation