BookmarkSubscribeRSS Feed
HongqiuGu
Calcite | Level 5

Is there any efficient way to draw broken axis graph in SAS?

Just as follow:

F1.large.jpg

2.jpg

4 REPLIES 4
Jay54
Meteorite | Level 14

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.:

Broken Y-Axis - Graphically Speaking

HongqiuGu
Calcite | Level 5

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;

飞信截图20140416095647.jpg

It seems that  you'll come to China on September 4.

Hope to see you!

Jay54
Meteorite | Level 14

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?

HongqiuGu
Calcite | Level 5

Generally, Y axis starts from non –zero is not suggested, especially for bar chart. Because it often brings us an illusion vision.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3309 views
  • 0 likes
  • 2 in conversation