Advanced ODS
Graphics Examples
Warren F. Kuhfeld
http://support.sas.com/documentation/prod-p/grstat/
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2015. Advanced ODS Graphics Examples. Cary,
NC: SAS Institute Inc.
Advanced ODS Graphics Examples
Copyright © 2015, SAS Institute Inc., Cary, NC, USA
All Rights Reserved. Produced in the United States of America.
For a hard-copy book
: No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by
any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute
Inc.
For a web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time
you acquire this publication.
The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher is
illegal and punishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronic
piracy of copyrighted materials. Your support of others’ rights is appreciated.
U.S. Government License Rights; Restricted Rights: The Software and its documentation is commercial computer software
developed at private expense and is provided with RESTRICTED RIGHTS to the United States Government. Use, duplication, or
disclosure of the Software by the United States Government is subject to the license terms of this Agreement pursuant to, as
applicable, FAR 12.212, DFAR 227.7202-1(a), DFAR 227.7202-3(a), and DFAR 227.7202-4, and, to the extent required under U.S.
federal law, the minimum restricted rights as set out in FAR 52.227-19 (DEC 2007). If FAR 52.227-19 is applicable, this provision
serves as notice under clause (c) thereof and no other notice is required to be affixed to the Software or documentation. The
Government’s rights in Software and documentation shall be only those set forth in this Agreement.
SAS Institute Inc., SAS Campus Drive, Cary, NC 27513-2414
November 2015
SAS
®
and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the
USA and other countries. ® indicates USA registration.
Other brand and product names are trademarks of their respective companies.
SAS software may be provided with certain third-party software, including but not limited to open-source software, which is
licensed under its applicable third-party software license agreement. For license information about third-party software distributed
with SAS software, refer to http://support.sas.com/thirdpartylicenses.
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 2. Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 3. Axis Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Chapter 4. Annotation . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Chapter 5. Bars, Lines, Curves, and Arrows . . . . . . . . . . . . . . . . . . . 145
Chapter 6. Plots of Labeled Points . . . . . . . . . . . . . . . . . . . . . . . 163
Chapter 7. Advanced Customization of Graphs That Analytical Procedures Produce . . . . . 197
Index 239
iv
Preface
If you are an experienced SAS user, you probably already know about ODS Graphics (also called ODS
Statistical Graphics) and how to do the following:
enable ODS Graphics so that analytical procedures produce graphical output together with tabular
output
modify graph templates to modify the output that analytical procedures produce
work with SAS styles
use SG procedures such as PROC SGPLOT to produce custom plots
If these topics are not already familiar to you, then you should start by looking at the chapters and book
listed in the section “About the Author” on page v. If you are familiar with these topics and want to learn
more, then you have found the right book. This book goes beyond the basics and works through a series
of advanced examples. Each example illustrates a small fraction of the incredible power of ODS Graphics.
In particular, there are many examples of PROC SGPLOT and the SG annotation facility. The last chapter
shows you how to customize every aspect of the graphs that analytical procedures produce.
Sample Code
The beginning of every example has a link that you can double click to see the SAS code for that example.
The first example has the following link:
These links work in Adobe Acrobat Reader and Internet Explorer but not in Google Chrome or Mozilla
Firefox.
About the Author
This book was written by Warren F. Kuhfeld, Distinguished Research Statistician Developer in SAS/STAT
Research and Development. Warren received his PhD in psychometrics from the University of North Carolina
at Chapel Hill in 1985 and joined SAS in 1987. He has used SAS since 1979 and has developed SAS
procedures since 1984.
In addition to writing the SAS Press book Statistical Graphics in SAS: An Introduction to the Graph
Template Language and the Statistical Graphics Procedures, Warren also wrote the following SAS/STAT
documentation chapters: Chapter 20, “Using the Output Delivery System” (SAS/STAT User’s Guide),
Chapter 21, “Statistical Graphics Using ODS” (SAS/STAT User’s Guide), Chapter 22, “ODS Graphics
Template Modification” (SAS/STAT User’s Guide), Chapter 23, “Customizing the Kaplan-Meier Survival
Plot” (SAS/STAT User’s Guide).
Warren maintains 11 SAS/STAT procedures. He developed 20 SAS macros for experimental designs for linear
and choice models. His 1,309-page book about discrete choice and other marketing research methods, Market-
ing Research Methods in SAS, is free on the web:
http://support.sas.com/resources/papers/
tnote/tnote_marketresearch.html
. Warren has also developed the world’s largest collection of
orthogonal arrays: http://support.sas.com/techsup/technote/ts723.html.
Double Click for Example Code