Is there any efficient way to draw broken axis graph in SAS?
Just as follow:
With SAS 9.4M1, you can request a broken axis for one axis at a time. Here is a blog article I wrote on this topic: Broken Axis - Graphically Speaking. All you have to do is provide the axis ranges you want to retain.
If you don't have SAS 9.4M1, you can consider some of the techniques I discuss in this article.:
Thanks Sanjay.
Graphically Speaking is a very nice blog, I have learn a lot from it .
For broken axis with double slash, like this: "// ", drawtext statement in PROC Template would be better.
Here is an example:
proc template;
define statgraph sgdesign;
dynamic _SEX _HEIGHT;
begingraph;
entrytitle halign=center 'Height by gender';
entryfootnote halign=left 'Broken axis demo';
layout lattice / rowdatarange=data columndatarange=data rowgutter=10 columngutter=10;
layout overlay /
yaxisopts=( type=linear
offsetmin=0.0
griddisplay=on
linearopts=( viewmin=0.0
viewmax=80.0
minorgrid=OFF
minorticks=OFF
tickvaluepriority=TRUE
tickvalueformat=BEST6.
tickvaluelist=(40.0 50.0 60.0 70.0 80.0)
tickdisplaylist=("0" "50" "60" "70" "80")
)
);
boxplot x=_SEX y=_HEIGHT / name='box' groupdisplay=Cluster;
drawrectangle x=58 y=128 width=4 height=4 /
display=all outlineattrs=(color=white) fillattrs=(color=white)
transparency=0 drawspace=graphpixel anchor=left;
drawtext textattrs=(size=12pt) "/" / x=55 y=138 rotate=-45
drawspace=graphpixel anchor=left border=false TRANSPARENCY=0;
drawtext textattrs=(size=12pt) "/" / x=55 y=120 rotate=-45
drawspace=graphpixel anchor=left border=false TRANSPARENCY=0;
endlayout;
endlayout;
endgraph;
end;
run;
proc sgrender data=SASHELP.CLASS template=sgdesign;
dynamic _SEX="SEX" _HEIGHT="HEIGHT";
run;
It seems that you'll come to China on September 4.
Hope to see you!
The benefit of this graph is not clear to me. There is no data below the break. Why is this better than just a Y axis that starts at 45?
Generally, Y axis starts from non –zero is not suggested, especially for bar chart. Because it often brings us an illusion vision.
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.