sas/graph 9.2 graph template language...

626
SAS/GRAPH ® 9.2 Graph Template Language Reference Second Edition SAS ® Documentation

Upload: lekhuong

Post on 19-Aug-2018

263 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

SAS/GRAPH® 9.2Graph Template LanguageReferenceSecond Edition

SAS® Documentation

Page 2: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The correct bibliographic citation for this manual is as follows: SAS Institute Inc. . 2010. . SAS/GRAPH® 9.2: Graph Template Language Reference,Second Edition. Cary, NC: SAS Institute Inc.

SAS/GRAPH® 9.2: Graph Template Language Reference, Second Edition

Copyright © 2010, SAS Institute Inc., Cary, NC, USA

ISBN 978-1-60764-675-4

All rights reserved. Produced in the United States of America.

For a hardcopy 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 thispublication.

U.S. Government Restricted Rights Notice: Use, duplication, or disclosure of this software and related documentation by the U.S. government issubject to the Agreement with SAS Institute and the restrictions set forth in FAR 52.227–19 Commercial Computer Software-Restricted Rights (June1987).

SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513.

1st electronic book, June 20102nd electronic book, July 20101st printing, June 2010

SAS® Publishing provides a complete selection of books and electronic products to help customers use SAS software to its fullest potential. For moreinformation about our e-books, e-learning products, CDs, and hard-copy books, visit the SAS Publishing Web site at support.sas.com/publishing or call 1-800-727-3228.

SAS® and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and othercountries. ® indicates USA registration.

Other brand and product names are registered trademarks or trademarks of their respective companies.

Page 3: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Contents

What’s New in SAS/GRAPH 9.2 Graph Template Language . . . . . . . . . . . . . . . . . . . . . ix

PART 1 Fundamentals 1

Chapter 1 • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Graph Template Language (GTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Basic Anatomy of an ODS Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Graphical Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Flexible Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15About the Examples in this Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

PART 2 Graph Block 19

Chapter 2 • BEGINGRAPH Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

PART 3 Layout Statements 27

Chapter 3 • Summary of Layout Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Overlay-type Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Multi-cell Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Data-driven Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Chapter 4 • LAYOUT DATALATTICE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Chapter 5 • LAYOUT DATAPANEL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Chapter 6 • LAYOUT GRIDDED Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Chapter 7 • LAYOUT LATTICE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Page 4: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Chapter 8 • LAYOUT OVERLAY Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Chapter 9 • LAYOUT OVERLAYEQUATED Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

Chapter 10 • LAYOUT OVERLAY3D Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

Chapter 11 • LAYOUT PROTOTYPE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

PART 4 Plot Statements 113

Chapter 12 • Key Concepts for Using Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115Minimum Requirements to Generate a Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115ODS Graphics Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116Display Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117Location and Position of Curve Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

Chapter 13 • BANDPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Chapter 14 • BARCHART Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Chapter 15 • BARCHARTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

Chapter 16 • BIHISTOGRAM3DPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

Chapter 17 • BLOCKPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

Chapter 18 • BOXPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

Chapter 19 • BOXPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

iv Contents

Page 5: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 20 • CONTOURPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

Chapter 21 • DENSITYPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

Chapter 22 • DROPLINE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

Chapter 23 • ELLIPSE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

Chapter 24 • ELLIPSEPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

Chapter 25 • FRINGEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

Chapter 26 • HISTOGRAM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

Chapter 27 • HISTOGRAMPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

Chapter 28 • LINEPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

Chapter 29 • LOESSPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

Chapter 30 • MODELBAND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

Chapter 31 • NEEDLEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Chapter 32 • PBSPLINEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

Chapter 33 • REFERENCELINE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

Contents v

Page 6: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 34 • REGRESSIONPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

Chapter 35 • SCATTERPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

Chapter 36 • SCATTERPLOTMATRIX Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

Chapter 37 • SERIESPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351

Chapter 38 • STEPPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

Chapter 39 • SURFACEPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375

Chapter 40 • VECTORPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383

PART 5 Plot Axes 393

Chapter 41 • Axis Features in Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395How Axis Features are Determined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395Controlling Axis Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400

Chapter 42 • Axis Options for LAYOUT OVERLAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

Chapter 43 • Axis Options for LAYOUT OVERLAY3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425

Chapter 44 • Axis Options for LAYOUT LATTICE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437

Chapter 45 • Axis Options for LAYOUT OVERLAYEQUATED . . . . . . . . . . . . . . . . . . . . . . . . . . 455Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455

Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL . . . . . . . . . . . . . . . . . . . 467Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467

vi Contents

Page 7: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PART 6 Legend Statements 489

Chapter 47 • CONTINUOUSLEGEND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491

Chapter 48 • DISCRETELEGEND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499

PART 7 Text Statements 507

Chapter 49 • Managing Text Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509Using Prefix Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510Using Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512Reserved Keywords and Unicode Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514

Chapter 50 • ENTRY Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

Chapter 51 • ENTRYFOOTNOTE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525

Chapter 52 • ENTRYTITLE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

PART 8 Runtime Programming Features 541

Chapter 53 • Dynamics and Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543Template Types on PROC TEMPLATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543DYNAMIC, MVAR, and NMVAR Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543Dynamics Compared to Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544

Chapter 54 • Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545GTL Expressions Compared to WHERE Expressions . . . . . . . . . . . . . . . . . . . . . . . . . 546An expression in Statement Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546

Chapter 55 • Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549Functions Used Only in GTL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549GTL Summary Statistic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550

Chapter 56 • Conditional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553Conditional Logic Determines Statement Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . 554GTL Does Not Provide ELSE IF Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555

Contents vii

Page 8: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PART 9 Appendices 557

Appendix 1 • Syntax Conventions and Argument Value Types . . . . . . . . . . . . . . . . . . . . . . . . . 559Syntax Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559Value Types for Statement Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

Appendix 2 • Display Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563General Syntax for Attribute Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563Attributes Available for the Attribute Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564Available Line Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566

Appendix 3 • SAS Formats Not Supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569Using SAS Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569Unsupported Numeric Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569Unsupported Date and Time Formats Related to IS0 8601 . . . . . . . . . . . . . . . . . . . . . 570Other Unsupported Date and Time Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570Unsupported Currency Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571

Appendix 4 • Computing Input Data for BOXPLOTPARM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573

Appendix 5 • Memory Management for ODS Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579SAS Options Affecting Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579Managing a Java Out Of Memory Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595

viii Contents

Page 9: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

What’s New in SAS/GRAPH 9.2Graph Template Language

Overview

The third maintenance release of the SAS/GRAPH Graph Template Language providesthe DISCRETEOFFSET= option, which enables you to offset the positions of bars, plotmarkers, and other data representations on a discrete axis.

Support for Offsets on Discrete Axes

The new DISCRETEOFFSET= option enables you to specify an offset for the data that arerepresented on a discrete axis. The offset is useful for graphing multiple response variableson a common axis in the graph.

For example, if multiple BARCHART statements with different response variables arespecified within an overlay-type layout, the bars for matching category values are, bydefault, centered on the midpoint axis values. Thus, the bars from the multiple bar chartsare superimposed on one another. By setting a different offset value on each BARCHARTstatement, you can display the bars for common response values side by side.

Similarly, within an overlay-type layout, the plot markers for a scatter plot are, by default,centered on the discrete X values, or discrete Y values, or both. If a SCATTERPLOTstatement and other plots are used together on a discrete axis, the scatter markers might besuperimposed over other graph data. By setting a different offset on each plot statement,you can offset the data on the common axis. This prevents the scatter markers from beingsuperimposed over the other graph data.

The DISCRETEOFFSET= option is available on the following plot statements:

• BARCHART statement

• BARCHARTPARM statement

• BOXPLOT statement

• BOXPLOTPARM statement

• DROPLINE statement

• REFERENCELINE statement

• SCATTERPLOT statement

• SERIESPLOT statement

• STEPPLOT statement

ix

Page 10: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

x What's New?

Page 11: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 1

Fundamentals

Chapter 1Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1

Page 12: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

2

Page 13: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 1

Overview

Graph Template Language (GTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3GTL and the Output Delivery System (ODS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3A Quick Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Template Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Run Time Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Basic Anatomy of an ODS Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Graphical Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Flexible Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Expressions and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Dynamics and Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Conditional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15ODS GRAPHICS Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15ODS Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

About the Examples in this Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Graph Template Language (GTL)

GTL and the Output Delivery System (ODS)The SAS/GRAPH Graph Template Language (GTL) is an extension to the Output DeliverySystem (ODS) that enables you to create sophisticated analytical graphics that are notavailable from traditional SAS/GRAPH procedure statements. For example, using the GTLyou can generate Model-Fit plots, Distribution Plots, Comparative plots, Prediction Plots,and more.

The graphics produced by the GTL are generated by template definitions that control thegraph format and appearance and specify the variable roles to represent in the graph display.The graphs can then be rendered by associating the templates with a data source.

• The GTL templates are defined with PROC TEMPLATE. The GTL includesconditional statements that can be used to determine what graph features are rendered,

3

Page 14: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

layout statements that specify the arrangement of graph features, plot statements thatrequest specific plot types (such as histograms and scatter plots), and text and legendstatements that specify titles, footnotes, legends, and other text-based graph elements.

• The GTL templates are rendered using the SGRENDER procedure, which specifies adata source that contains appropriate data values and the template to use for renderingthe graph.

• You can also modify predefined GTL templates that the SAS System delivers for useon the SAS statistical procedures. For information about modifying existing templates,refer to SAS/STAT User’s Guide.

This manual provides a complete reference to the Graphics Template Language. Fordetailed usage information, consult the SAS/GRAPH: Graph Template Language User'sGuide.

A Quick ExampleThe data set SASHELP.CLASS is delivered with the SAS System. It includes data columnsnamed HEIGHT and WEIGHT, which store height and weight measures for a small sampleof subjects. The Graphics Template Language can be used to generate a histogram thatshows the distribution of weight recorded in that data set:

The following SAS program produces the graph:

proc template; define statgraph histogram; begingraph; layout overlay; histogram weight; endlayout; endgraph; end;run;

4 Chapter 1 • Overview

Page 15: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ods graphics / width=450px;ods listing;proc sgrender data=sashelp.class template=histogram;run;

• The DEFINE STATGRAPH statement on PROC TEMPLATE opens a definition blockfor defining a graphics template named HISTOGRAM. The HISTOGRAM templateis stored in the template folder (also called the “template store,” by default located inSASUSER.TEMPLAT).

• The template definition for HISTOGRAM specifies two GTL statements within aBEGINGRAPH/ENDGRAPH block: LAYOUT OVERLAY and HISTOGRAM.

• The LAYOUT OVERLAY statement is one of the most fundamental layout statements.It can overlay the results of one or more plot statements, each of which shares the sameplot area, axes, and legends. The layout in this example specifies only a single element:a HISTOGRAM with bars showing the distribution of observations of the data columnnamed WEIGHT.

• The ENDLAYOUT statement ends the layout block, the ENDGRAPH statement endsthe graph definition, and the END statement ends the template definition.

• The ODS GRAPHICS statement uses the WIDTH= option to set a width for the outputgraph. Because the HEIGHT= option is not specified, GTL manages the graph’s aspectratio and set an appropriate height.

• The ODS LISTING statement opens the LISTING destination for the output. TheLISTING destination is open by default. However, explicitly specifying it ensures thatit is active for this graph in case another ODS destination has been set in the currentSAS session.

• The DATA= option on PROC SGRENDER specifies SASHELP.CLASS as the datasource for the graph. TEMPLATE= specifies HISTOGRAM as the template definitionto use for rendering the graph.

Template CompilationA GTL template describes the structure and appearance of a graph to be produced, similarto the way a TABLE template describes the organization and content of a table.

All templates are stored, compiled programs. The following source program produces asimple GTL template named SCATTER:

proc template; define statgraph scatter; begingraph; layout overlay; scatterplot x=height y=weight; endlayout; endgraph; end;run;

When this code is submitted, the statement keywords and options are parsed, just as withany other procedure. If no syntax error is detected, an output template named SCATTERis created and stored in the default template folder SASUSER.TEMPLAT. No graph isproduced. Note the following:

Graph Template Language (GTL) 5

Page 16: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• Any required arguments in the template must be specified. In this example, X= and Y=in the SCATTERPLOT statement must specify variables for the analysis, but nochecking for the existence of these variables is done at compile time. (Unlike other SASprocedures, PROC TEMPLATE does not perform a compile and then run sequence,which includes variable validation.)

• No reference to an input data set appears in the template.

Run Time ActionsTo produce a graph, a GTL template must be bound to a data source using the SGRENDERprocedure. The following example uses SGRENDER to bind the SCATTER template tothe SAS data set SASHELP.CLASS, which is delivered with the SAS system:

ods listing;proc sgrender data=sashelp.class template=scatter;run;

Generally, an ODS data object is constructed by comparing the template references tocolumn names with variables that exist in the current data set. In the current example,SASHELP.CLASS contains variables named HEIGHT and WEIGHT. Because thesevariable names match the variables that are named on template SCATTER, variablesHEIGHT and WEIGHT are added to the data object, while other variables inSASHELP.CLASS are ignored. (It is possible for a template to define new computedcolumns based on existing columns.)

After all the observations have been read, the data object and template definition are passedto a graph renderer, which produces an image file for the graph. The image file is thenautomatically integrated into the ODS destination. In this example, a PNG image is createdin the LISTING destination. The visual properties of the graph are determined by the ODSstyle that is in effect.

Note: Template SCATTER is a restrictive definition: it can create a plot only with variablesnamed HEIGHT and WEIGHT. A GTL template can be made more flexible byintroducing dynamics or macro variables that supply variables and other informationat run time. For more information, see “Flexible Templates” on page 12.

6 Chapter 1 • Overview

Page 17: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Basic Anatomy of an ODS GraphThe GTL is flexible and able to produce many different types of graphs with varying layoutfeatures. The following figure shows the basic anatomy of an ODS graph:

Graphthe output produced from all of the statements that are nested in a BEGINGRAPHstatement block. The graph comprises all of the graphics elements in the templatedefinition.

Title Areaarea for one or more titles. This area is always displayed above all cells in the graph.

Footnote Areaarea for one or more footnotes. This area is always displayed below all cells in thegraph.

Cellrefers collectively to the area containing the plot areas. In this diagram, there are twocells, each of which contains two axes for the plot area. A cell can also containdescriptive text and legends. Graphs are often described as single-cell or multi-cell.

Plot Areathe display area for plot-statement results. This area is bounded by the axes (whenpresent) and can also contain data labels and other text that annotates the graph.

Axisrefers collectively to the axis line, the major and minor tick marks, the major tick values,and the axis label.

Plotsrefers collectively to all plot statements that can be overlaid in the plot area. Thisincludes graphical items such as fit lines, scatter plots, reference lines, and many others.

Basic Anatomy of an ODS Graph 7

Page 18: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Legendrefers collectively to one or more legend entries, each made up of a graphical value anda text label. The legend can also have a title and border. Legends can also display acolor ramp corresponding to a continuous response range.

Graphical LayoutsOne of most powerful features of the GTL is the syntax built around hierarchical statementblocks called “layouts.” The outermost layout block determines

• The overall organization of the graph—whether it uses a single-cell or a multi-celldisplay.

• What statements are allowed in the block. Generally, layout blocks can contain plots,lines of text, a legend, or even another layout.

• How the contained statements interact.

Table 1.1 Outermost Layouts in GTL

Layout Description

OVERLAY General purpose layout for displaying 2-D plotsin a single-cell.

OVERLAY3D Layout for displaying 3-D plots in a single-cell.

OVERLAYEQUATED Specialized OVERLAY with equated axes.

GRIDDED Basic grid of plots. All cells are independent.

LATTICE Advanced multi-cell layout. Axes can be sharedacross columns or rows and be external to grid.Many grid labeling and alignment features.

DATALATTICE Generates a classification panel from the valuesof 1 or 2 classifiers.

DATAPANEL Generates a classification panel from the valuesof n classifiers.

For example, the following graph is a two-cell graph produced using the LAYOUTLATTICE statement as the outermost template in the layout.

8 Chapter 1 • Overview

Page 19: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The LAYOUT LATTICE statement is typically used to create a multi-cell layout of plotsthat are aligned across columns and rows. In the following template, which produced thegraph, plot statements are specified within nested LAYOUT OVERLAY statements. Thus,the LATTICE automatically aligns the plot areas and tick display areas in the plots. TheLATTICE layout is a good layout to choose when you want to compare the results of relatedplots.

proc template; define statgraph lattice; begingraph; entrytitle "Car Performance Profile"; layout lattice / border=true pad=10 opaque=true rows=1 columns=2 columngutter=3; layout overlay; scatterplot x=horsepower y=mpg_city / group=origin name="cars"; regressionPlot x=horsepower y=mpg_city / degree=2; endlayout;

layout overlay; scatterplot x=weight y=mpg_city / group=origin; regressionPlot x=weight y=mpg_city / degree=2; endlayout; sidebar; discretelegend "cars"; endsidebar; endlayout; endgraph; end;run;

For detailed information about each layout, see the chapter for that layout type.

Graphical Layouts 9

Page 20: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PlotsThe plots in the GTL are classified in different ways, depending on the context of thediscussion.

Within layout blocks, plots are often classified according to graphical dimension: whetherthey are projected in two or three visual dimensions. Thus, plots in the GTL are oftenreferred to as 2-D or 3-D plots, based on their graphical dimensions, not their datadimensions.

Relative to their input data, plots are classified according to the statements that calculatesummary statistics from raw input data, and those that use calculated statistics as inputparameters on the plot statement. Thus, many GTL plot statements have two versions:BARCHART and BARCHARTPARM, HISTOGRAM and HISTOGRAMPARM, and soforth. The main distinction between such plots is the nature of the input data that theyaccept:

• The “non-parm” version (for example, BARCHART) computes its values from raw,unsummarized data. For example, a BARCHART computes the summary values itneeds for the bars in the chart. Such plots are often referred to as “computed plots.”

• The “parm” version (for example, BARCHARTPARM) does not summarize orcompute values from the input data but instead simply renders the input data it is given.Thus, the input data must be pre-summarized, perhaps by a SAS procedure. The “parm”version of plots, often referred to as “parameterized plots,” produce the same result asthe non-parm version. However, they don’t perform the calculations or datasummarizations needed to achieve the result.

Chapter 12, “Key Concepts for Using Plots,” on page 115 discusses general concepts thatapply across plot types. For detailed information about a particular plot, see the chapter forthat plot.

AxesThe GTL uses various criteria to determine the displayed axis features for a graph.Generally, axis features are based on the layout type, the order of plot statements in thelayout and the options specified on those statements, the use of “primary” and “secondary”axes on the plots (when secondary axes are supported), the plot type, the column(s) of datathat contribute to defining the axis range, and the data formats for the contributing datacolumns.

Depending on the layout type, 2-D plots can have up to four independent axes that can bedisplayed: X, Y, X2, and Y2. The X and Y axes are considered the primary axes, and theX2 and Y2 axes are considered the secondary axes. By default, the X2 and Y2 axes are notdisplayed. When requested, the secondary axes can be displayed as copies of the primaryaxes, or data can be mapped separately to them. The following figure identifies the X, Y,X2, and Y2 axes.

10 Chapter 1 • Overview

Page 21: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

All 3-D plots display the standard X, Y, and Z axes.

For more information about axis features in GTL, see Chapter 41, “Axis Features inLayouts,” on page 395.

LegendsMany plot statements support a GROUP= option that partitions the data into unique values,performs separate analysis, if necessary, and automatically assigns distinct visualproperties to each group value. The visual properties of group values are defined by thestyle in effect.

Legends are not automatically displayed for plots with group values. Rather, an appropriatelegend statement must be added to the template to generate the desired legend. In thefollowing example, a legend is added to display markers and line patterns that show theassociation between the group values from a scatter plot and corresponding linearregression lines. The example shows the mechanism that GTL uses to associate a legendwith its corresponding plot(s): a name is assigned to each plot that must be represented inthe legend, and these names are then used as arguments for the legend statement (in thiscase, DISCRETELEGEND).

proc template; define statgraph scatterfit; begingraph;

Legends 11

Page 22: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

entrytitle "Linear Regression By Gender"; layout overlay; scatterplot x=height y=weight / group=sex name="scat"; regressionplot x=height y=weight/ group=sex name="reg"; discretelegend "scat" "reg" / border=true; endlayout; endgraph; end;run;

For more information about managing legends in GTL, see SAS/GRAPH: Graph TemplateLanguage User's Guide.

Flexible TemplatesSeveral features in the GTL can make template definitions less restrictive on input data andmore general in nature. These features enable a single compiled template to produce manyoutput variations.

Expressions and FunctionsIn the GTL, expressions can be used to compute constants and data columns. Theexpressions must be enclosed in an EVAL construct. Within the expression you can useDATA step functions, arithmetic operators, and other special functions supported by theGTL.

Expressions are also useful in text statements like ENTRY and ENTRYTITLE. Both ofthese statements support rich text and have special text commands such as {SUP}, {SUB},and {UNICODE}, which enable subscripting, superscripting, and Unicode characters.

The following template shows how the ± symbol is included in the title line using itshexadecimal Unicode value. Also, new data columns are computed for the upper and lowererror bars of the scatter plot, based on the input columns MEANWEIGHT and STDERR.

proc template; define statgraph expression; begingraph; entrytitle "Errorbars show " {unicode "00B1"x} "2 SE"; layout overlay; scatterplot x=age y=meanweight /

12 Chapter 1 • Overview

Page 23: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

yerrorlower=eval(meanweight - 2*stderr) yerrorupper=eval(meanweight + 2*stderr); seriesplot x=age y=meanweight; endlayout; endgraph; end; run;

For more information about using expressions, see Chapter 54, “Expressions,” on page545. For more information about using functions, see Chapter 55, “Functions,” on page549.

Dynamics and Macro VariablesAn extremely useful technique for generalizing templates is to define dynamics, macrovariables, or both. The dynamics and macro variables resolve when the template isexecuted. The following PROC TEMPLATE statements can be used in a DEFINESTATGRAPH block:

Template Statement Purpose Value supplied by...

DYNAMIC defines dynamic(s) either of the following:

• DYNAMIC= suboptionof ODS= option of FILEPRINT

• DYNAMIC statement ofPROC SGRENDER

MVAR defines macro variable( s) %LET or CALL SYMPUT( )

NMVAR defines macro variable( s) thatresolves to a number(s)

%LET or CALL SYMPUT( )

NOTES provides information aboutthe graph definition

user-supplied text

The following example defines a template named DYNAMICS that can create a histogramand density plot for any variable. It defines both macro variables and dynamics for run timesubstitution. No data-dependent information is hard coded in the template.

Note: You can initialize macro variables with %LET statements and dynamics withSGRENDER’s DYNAMIC statement.

proc template; define statgraph dynamics; mvar SYSDATE9 SCALE; nmvar BINS; dynamic VAR VARLABEL; begingraph; entrytitle "Histogram of " VAR; entrytitle "with Normal Distribution"; layout overlay / xaxisopts=(label=VARLABEL); histogram VAR / scale=SCALE nbins=BINS; densityplot VAR / normal(); endlayout;

Flexible Templates 13

Page 24: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

entryfootnote halign=right "Created: " SYSDATE9 / textattrs=GraphValueText; endgraph; end;run;

%let bins=6;%let scale=count;proc sgrender data=sashelp.class template=dynamics; dynamic var="Height" varlabel="Height in Inches";run;

For more information about using dynamics and macro variables, see Chapter 53,“Dynamics and Macro Variables,” on page 543.

Conditional LogicUsing conditional logic, you can create templates that have multiple visual results or outputrepresentations, depending on existing conditions. The evaluation of a logical expressionmust generate one or more complete statements (not portions of statements). All conditionallogic uses one of the following constructs:

if ( condition ) statement(s);endif;

if ( condition ) statement(s);else statement(s);endif;

On the IF statement, condition must be enclosed in parentheses. The condition can be anystandard SAS expression involving arithmetic, logical operators, comparison operators,Boolean operators, or concatenation operators. The expression can also use SAS DATAstep functions. The expression resolves to a single numeric value, which is true or false.

In the following example, a histogram is conditionally overlaid with a normal distributioncurve, a Kernel Density Estimate distribution curve, both, or neither:

proc template; define statgraph conditional; dynamic VAR VARLABEL BINS CURVE;

14 Chapter 1 • Overview

Page 25: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

begingraph; entrytitle "Histogram of " VAR; layout overlay / xaxisopts=(label=VARLABEL); histogram VAR / nbins=BINS; if (upcase(CURVE) in ("ALL" "KERNEL")) densityplot VAR / kernel() name="k" legendlabel="Kernel" lineattrs=(pattern=dash); endif;

if (upcase(CURVE) in ("ALL" "NORMAL")) densityplot VAR / normal() name="n" legendlabel="Normal"; endif;

discretelegend "n" "k"; endlayout; endgraph; end;run;

Note that the legend syntax does not have to be made conditional. At run time, each plotname in the legend is checked. If the plot does not exist, its name is removed from thelegend name list. If no names appear in the DISCRETELEGEND statement, the legend“drops out” and the histogram is resized to fill the remaining space.

For more information about using conditional logic, see Chapter 56, “Conditional Logic,”on page 553.

OutputWhen using the GTL, you focus primarily on defining template definitions that producespecific graphs and generate a particular output layout. Ultimately, you must also tailor thegraphical environment to get the exact output that you desire. The ODS GRAPHICSstatement is available for tailoring the graphical environment, and ODS styles enable youto manage the output appearance.

ODS GRAPHICS StatementThe ODS GRAPHICS statement is used to modify the environment in which graphicstemplates are executed. The ODS GRAPHICS statement is used to control

• whether ODS graphics is enabled

• the type and name of the image created

• the size of the image

• whether features such as scaling and anti-aliasing are used.

The following ODS GRAPHICS statement uses the HEIGHT= and WIDTH= options toset an aspect ratio for the output image.

ods graphics on / height=175px width=200px; proc sgrender data=sashelp.class template=scatter;

Output 15

Page 26: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

run;ods graphics off;

For more information about using the ODS GRAPHICS statement in GTL, seeSAS/GRAPH: Graph Template Language User's Guide. For a more complete discussionof the ODS GRAPHICS statement, see SAS Output Delivery System: User’s Guide.

ODS StylesWhen any graphics template is executed, there is always an ODS style in effect that governsthe appearance of the output. The following ODS statement sends graphics output to theRTF output destination using the LISTING style:

ods rtf style=listing;

ods graphics on / height=175px width=200px border=off; proc sgrender data=sashelp.class template=scatter; run;ods graphics off;

ods rtf close;

Support for ODS styles is highly integrated into GTL syntax. By default, the graphicalappearance features of most plot and text statements are mapped to corresponding styleelements and associated attributes. Because of this, your output tables and graphs alwayshave a reasonable overall appearance. Moreover, output for a given ODS destination hasa consistent look (for example, table colors and graph colors don’t clash).

The following figures show how a graph’s appearance can be changed by using referencesto style elements to set the graph’s appearance options. This technique permits changes ingraph appearance by style modification instead of graphical template modification. Thegraphs in the figures are generated with the following GTL statement:

contourplotparm x=x y=y z=density / contourtype=fill nhint=9 colormodel=ThreeColorRamp ;

The following style template shows the definition for the ThreeColorRamp style element:

style ThreeColorRamp / endcolor = GraphColors("gramp3cend") neutralcolor = GraphColors("gramp3cneutral") startcolor = GraphColors("gramp3cstart");

16 Chapter 1 • Overview

Page 27: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

For more information about the use of ODS styles in GTL, see SAS/GRAPH: GraphTemplate Language User's Guide. For a more complete discussion of ODS styles, see SASOutput Delivery System: User’s Guide. The SAS/STAT User’s Guide also has a detaileddiscussion for using styles with ODS Graphics.

About the Examples in this DocumentationThe programs in this documentation often provide all of the code that you need to generatethe graphs that are shown in the figures. We encourage you to copy and paste the code intoyour SAS session and generate the graphs for yourself. The graphs that you generate in theLISTING destination are rendered in their default 640 pixel by 480 pixel size. Theexception is the examples that show you how to change the graph size.

The graphical output in this documentation does not show graphs in their default sizebecause of the limitations of the production system used. The maximum graph width thatcan be included in this document is 495 pixels. Hence, all graphs are scaled down to fit.

When graphs that are produced with ODS graphics are reduced in size, several automaticprocesses take place to optimize the appearance of the output. Among the differencesbetween default size graphs and smaller graphs are that the smaller graphs have scaleddown font sizes. Also, their numeric axes might display a reduced number of ticks and tickvalues. Thus, the graphs that you generate from the example programs will not always lookidentical to the graphs that are shown in the figures. However, both graphs will accuratelyrepresent the data.

When producing your graphical output, you can scale the graph size and also modify fontattributes if needed. The SAS/GRAPH: Graph Template Language User's Guide provideschapters that explain how to set fonts, DPI, anti-aliasing, and other features that contributeto producing professional-looking graphics of any size in any output format.

About the Examples in this Documentation 17

Page 28: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

18 Chapter 1 • Overview

Page 29: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 2

Graph Block

Chapter 2BEGINGRAPH Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

19

Page 30: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

20

Page 31: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 2

BEGINGRAPH Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Description and SyntaxDefines the outermost container for a single GTL-layout-block and one or more GTL-global-statements.

BEGINGRAPH </option(s)>;<GTL-global-statements>GTL-layout-block<GTL-global-statements>

ENDGRAPH;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 22:

21

Page 32: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThe BEGINGRAPH statement block is a required outermost container for any graphtemplate. One if its purposes is to support options that control the graph size. When youknow that the default graph a template produces is better viewed with a different size oraspect ratio, you can declare default sizing information. To do so, use theDESIGNWIDTH= option, or the DESIGNHEIGHT= option, or both. This program showsone way to set the width and height of two graph cells to be equal.

proc template; define statgraph begingraph; dynamic XVAR YVAR; begingraph / designwidth=640px designheight=320px; layout lattice / columns=2; layout overlayequated / equatetype=square; entry "Linear Regression Fit" / valign=top texttattrs=(weight=bold); scatterplot x=XVAR y=YVAR / datatransparency=.5; regressionplot x=XVAR y=YVAR; endlayout; layout overlayequated / equatetype=square; entry "Loess Fit" / valign=top texttattrs=(weight=bold); scatterplot x=XVAR y=YVAR / datatransparency=.5; loessplot x=XVAR y=YVAR; endlayout; endlayout; endgraph; end;run;

proc sgrender data=sashelp.iris template=begingraph; dynamic title="Square Plot" xvar="SepalLength" yvar="SepalWidth";run;

22 Chapter 2 • BEGINGRAPH Statement

Page 33: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement SummaryAll template definitions in the Graphics Template Language must start with aBEGINGRAPH statement and conclude with an ENDGRAPH statement.

Within a BEGINGRAPH block, at least one GTL-layout-block is required. It can be aLATTICE, GRIDDED, OVERLAY, OVERLAYEQUATED, OVERLAY3D,DATALATTICE, or DATAPANEL layout block. This layout block should contain at leastone plot statement.

The GTL-global-statements include one or more ENTRYTITLE, ENTRYFOOTNOTE, orIF / ELSEIF/ ELSE statements. Any of these global statements can precede or follow theGTL-layout-block.

By default, graphs are rendered at 640px by 480px (4:3 aspect ratio). To change the graphsize for the output of a single BEGINGRAPH block, use the DESIGNWIDTH= andDESIGNHEIGHT= options on that BEGINGRAPH statement. For example, the templatein the “Example Program” on page 22 uses DESIGNHEIGHT= to change the graph heightto 320px. To prevent the graph width from automatically scaling to preserve the 4:3 aspectratio, it uses DESIGNWIDTH= to maintain the 640px width. The setting ensures that eachgraph cell is square (320px by 320px).

Note: To change the graph sizes for all templates in the current SAS session, use theWIDTH= and HEIGHT= options in the ODS GRAPHICS statement. Size settings inthe ODS GRAPHICS statement override size settings in the BEGINGRAPH statementand remain in effect unless they are changed on another ODS GRAPHICS statement.

The following template defines a square graph (equal height and width, 1:1 aspect ratio)by setting the design width equal to the internal default height (480px). The setting is madewith DESIGNWIDTH=DEFAULTDESIGNHEIGHT:

proc template; define statgraph squareplot; dynamic title xvar yvar; begingraph / designwidth=defaultDesignHeight; entrytitle title; layout overlayequated / equatetype=square; scatterplot x=xvar y=yvar; regressionplot x=xvar y=yvar; endlayout; endgraph; end;run;

If this template were executed with the following GRENDER procedure statement, a 480pxby 480px graph would be created:

proc sgrender data=mydata template="squareplot" ;dynamic title="Square Plot" xvar="time1" yvar="time2";run;

If the ODS GRAPHICS statement’s WIDTH= or HEIGHT= options change the designwidth or design height, the squareplot template’s 1:1 aspect ratio would still be honored.Thus, both of the following GRENDER procedure statements would create a 550px by550px graph:

ods graphics / width=550px;proc sgrender data=mydata template="squareplot" ;

Example Program and Statement Details 23

Page 34: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

dynamic title="Square Plot" xvar="time1" yvar="time2";run;

ods graphics / height=550px;proc sgrender data=mydata template="squareplot" ;dynamic title="Square Plot" xvar="time1" yvar="time2";run;

Options

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the graph background.

BORDER Specifies whether a border is drawn around thegraph.

BORDERATTRS Specifies the properties of the border linearound the graph.

DESIGNHEIGHT Specifies the design height of the graph.

DESIGNWIDTH Specifies the design width of the graph.

PAD Specifies the amount of extra space that isadded inside the graph border.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the graph background.

Default: The GraphBackground:Color style reference.

style-referenceA reference of the form style-element:style-attribute. Only the style attribute namedCOLOR is used.

BORDER=booleanspecifies whether a border is drawn around the graph.

Default: TRUE

Interaction: If this option is set to FALSE, the BORDERATTRS= option is ignored.

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the graph. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

DESIGNHEIGHT=DEFAULTDESIGNHEIGHT | dimensionspecifies the design height of the graph.

Default: DEFAULTDESIGNHEIGHT. This value is obtained from the SAS Registrykey Products ð Graph ð ODS ð StatGraph ð DefaultDesignHeight when thegraph is rendered. The initial value of this registry key is 640px.

24 Chapter 2 • BEGINGRAPH Statement

Page 35: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: The design height can be overridden at run time with the HEIGHT= optionof the ODS GRAPHICS statement (external to the template).

The value of the DefaultDesignHeight registry key can be changed. Doing so wouldaffect the design height of all templates that do not include an explicit dimension forthe design height.

DESIGNWIDTH=DEFAULTDESIGNWIDTH | dimensionspecifies the design width of the graph.

Default: DEFAULTDESIGNWIDTH. This value is obtained from the SAS Registrykey Products ð Graph ð ODS ð StatGraph ð DefaultDesignWidth when the graphis rendered. The initial value of this registry key is 480px.

Interaction: The design width can be overridden at run time with the WIDTH= optionof the ODS GRAPHICS statement (external to the template).

The value of the DefaultDesignWidth registry key can be changed. Doing so wouldaffect the design width of all templates that do not include an explicit dimension forthe design width.

PAD=dimension | (pad-options)specifies the amount of extra space that is added inside the graph border.

Default: The default padding for all sides is 10. Values without units are in pixels (px).A unit must be provided if other than pixels.

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the layout border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

Example Program and Statement Details 25

Page 36: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

26 Chapter 2 • BEGINGRAPH Statement

Page 37: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 3

Layout Statements

Chapter 3Summary of Layout Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Chapter 4LAYOUT DATALATTICE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Chapter 5LAYOUT DATAPANEL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Chapter 6LAYOUT GRIDDED Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Chapter 7LAYOUT LATTICE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Chapter 8LAYOUT OVERLAY Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Chapter 9LAYOUT OVERLAYEQUATED Statement . . . . . . . . . . . . . . . . . . . . . . . . . 95

Chapter 10LAYOUT OVERLAY3D Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

Chapter 11LAYOUT PROTOTYPE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

27

Page 38: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

28

Page 39: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 3

Summary of Layout Statements

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Overlay-type Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Multi-cell Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Data-driven Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

OverviewLayout blocks always begin with the LAYOUT keyword followed by a keyword indicatingthe purpose of the layout. All layout blocks end with an ENDLAYOUT statement.

The following sections summarize the available layouts. To learn more about a layout, seethe chapter devoted to that layout.

Overlay-type Layouts

Layout(Description)

Graphics Allowedand Cells Produced Comments Example

OVERLAY (SingleCell)

2-D (1 cell) General purposelayout forsuperimposing 2-Dplots

OVERLAYEQUATED (Single Cell)

2-D (1 cell) SpecializedOVERLAY withequated axes

PROTOTYPE(Single Cell)

2-D (1 cell) SpecializedLAYOUT used onlyas child layout ofDATAPANEL orDATALATTICE

29

Page 40: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Layout(Description)

Graphics Allowedand Cells Produced Comments Example

OVERLAY3D(Single Cell)

3-D (1 cell) General purpose 3-Dlayout forsuperimposing 3-Dplots.

Multi-cell Layouts

Layout(Description)

Graphics Allowedand Cells Produced Comments Example

LATTICE (AdvancedMulti-cell)

2-D (1 or more cells) All cells must bepredefined. Axes canbe shared acrosscolumns or rows andbe external to grid.Many grid labelingand alignmentfeatures.

GRIDDED (SimpleMulti-cell)

2-D (1 or more cells) All cells must bepredefined. Axesindependent for eachcell. Very simplemulti-cell container.

30 Chapter 3 • Summary of Layout Statements

Page 41: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Data-driven Layouts

Layout(Description)

Graphics Allowedand Cells Produced Comments Example

DATAPANEL(Classification Panel)

2-D (1 or more cells) Displays a panel ofsimilar graphs basedon data subsets byclassificationvariable(s). Numberof cells is based oncrossings of nclassificationvariable(s).

DATALATTICE(Classification Panel)

2-D (1 or more cells) Displays a panel ofsimilar graphs basedon data subsets byclassificationvariable(s). Numberof cells is based oncrossings of 1 or 2classificationvariables.

Data-driven Layouts 31

Page 42: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

32 Chapter 3 • Summary of Layout Statements

Page 43: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 4

LAYOUT DATALATTICEStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Required Argument(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36Prototype Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Sidebar Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

Description and SyntaxCreates a grid of graphs based on one or two classification variables and a graphicalprototype. By default, a separate instance of the prototype (a data cell) is created for eachpossible combination of the classification variables.

LAYOUT DATALATTICE argument(s) </option(s)>;graph-prototype-block;<sidebar-statement-block(s);>

ENDLAYOUT;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 34:

33

Page 44: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThis example shows the result of using row and column classification variables. In thiscase, a four-column, three-row data lattice is created:

• The classification values are placed as row or column labels by default.

• The ROWDATARANGE = UNION option assures that an axis range is computedseparately for each row using the data ranges of all Y= variables in that row. Thisfacilitates the visual comparison of the data cells.

• A SIDEBAR block is used to place the legend at the bottom of the lattice.

proc template; define statgraph layoutdatalattice; begingraph; entrytitle "Annual Furniture Sales Comparisons"; layout datalattice rowvar=country columnvar=year / rowdatarange=union headerlabeldisplay=value headerbackgroundcolor=GraphAltBlock:color rowaxisopts=(display=(tickvalues) griddisplay=on linearopts=(tickvalueformat=dollar12.)) columnaxisopts=(display=(tickvalues) timeopts=(tickvalueformat=monname3.)); layout prototype / cycleattrs=true; seriesplot x=month y=TotalActual / name="Actual"; seriesplot x=month y=TotalPredict / name="Predict"; endlayout; sidebar / align=bottom; discretelegend "Actual" "Predict" / border=false; endsidebar; endlayout;

34 Chapter 4 • LAYOUT DATALATTICE Statement

Page 45: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

endgraph; end;run;

proc summary data=sashelp.prdsal2 nway; class country year month; var actual predict; output out=prdsal2 sum=TotalActual TotalPredict;run;

proc sgrender data=prdsal2 template=layoutdatalattice;run;

Statement SummaryThe LAYOUT DATALATTICE statement makes it easy to create a grid of graphs, basedon the values of one or two classifications variables. To create a grid that is based on morethan two classification variables, or to have more control over the grid layout, use LAYOUTDATAPANEL instead.

By default, the number of cells in the layout is determined by the number of value pairingsthat are possible for the classification values plus any empty cells needed to complete thelast row/column of the grid. The contents of each data cell are based on a graph prototypethat you specify in the graph-prototype-block. You can enhance the display using one ormore sidebar-statement-blocks. For classification variables that have many values, you canuse the COLUMNS= and or ROWS= options and the PANELNUMBER= option togenerate multiple panel displays.

Classification variables for the layout are specified on the ROWVAR= argument (to specifya row variable), or the COLUMNVAR= argument (to specify a column variable), or botharguments to specify both a column and a row variable. The graph prototype for each datacell’s contents is specified within a “Prototype Block” on page 37 block, and sidebarsare specified within SIDEBAR blocks. The LAYOUT PROTOTYPE and SIDEBARblocks are nested within the LAYOUT DATALATTICE block.

By default, the first data cell to be filled is in the layout’s top left corner. Use theSTART= option to change the starting data cell to the bottom left corner.

Rather than display the header labels outside the grid, you can setHEADERLABELLOCATION= INSIDE to display them inside the grid, as shown in thefollowing figure:

Example Program and Statement Details 35

Page 46: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Note: The DATALATTICE layout is designed to be the outermost layout in the template.

Required Argument(s)One of the ROWVAR= or COLUMNVAR= arguments is required. Both can be specified.Each specifies a single classification variable. Any one of the following uses is valid:

LAYOUT DATALATTICE ROWVAR=class-varLAYOUT DATALATTICE COLUMNVAR=class-varLAYOUT DATALATTICE ROWVAR=class-var COLUMNVAR=class-var

If you do not explicitly manage columns and rows using the COLUMNS= and ROWS=options, the default layout behavior is as follows:

• If both ROWVAR= and COLUMNVAR= are specified, a data cell is created for eachof the value pairings that are possible for the classification values of the specifiedvariables. If the ROWVAR variable has R distinct values and the COLUMNVARvariable has C distinct values, the dimension of grid produced is R x C.

• If only the ROWVAR variable is used, an R x 1 grid is produced.

• If only the COLUMNVAR variable is used, a 1 x C grid is produced.

Variable values are always retained in data order. Formats can be assigned to class variablesto create classification levels (for example, an AGEGROUPFMT. format for numericAGE).

The output size does not grow automatically as the number of cells increases. To set a panelsize for the current template, use the DESIGNHEIGHT= and DESIGNWIDTH= optionsin the BEGINGRAPH statement. To set a panel size for all templates in the current SASsession, use the HEIGHT= and WIDTH= options in the ODS GRAPHICS statement. Sizesettings in the ODS GRAPHICS statement override size settings in the BEGINGRAPHstatement. The default output width is 640px, and the default output height is 480px.

36 Chapter 4 • LAYOUT DATALATTICE Statement

Page 47: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

As the number of cells in the grid increases, the size of each cell decreases. At some pointthe cells might become so small that a meaningful graph cannot be rendered. TheCELLHEIGHTMIN= and CELLWIDTHMIN= options set a threshold for the smallest cell.If the actual cell height or width becomes smaller, no panel is drawn. The default minimumcell size is CELLHEIGHTMIN=100px and CELLWIDTHMIN=100px.

Using the default panel size and cell size, the DATALATTICE layout accommodates agrid of about 24 cells (6 columns by 4 rows). If you know that the number of cells is larger,you should increase the overall panel size, or decrease the minimum cell size, or both. Youcan also use ROWS=, COLUMNS=, and PANELNUMBER= options to partition your dataso a number of smaller grids are produced that cumulatively show all of the value crossings.

Prototype BlockYou must specify a single graph-prototype-block within the LAYOUT DATALATTICEblock, using the following syntax:

LAYOUT PROTOTYPE </option(s)>;GTL-statement(s);

ENDLAYOUT;

The graph-prototype-block determines the graphical content of each data cell and isrepeated within each data cell, based on the subsets of the classification variables.

For more information about the LAYOUT PROTOTYPE block and the list of availableoptions, see “LAYOUT PROTOTYPE Statement” on page 109.

Sidebar BlocksA LAYOUT DATALATTICE enables you to display one or more sidebars outside of theaxes. A sidebar spans across columns or rows and is useful for displaying information thatapplies to all of the columns or all of the rows. For example, sidebars are useful fordisplaying a legend.

A SIDEBAR statement has the following syntax:

SIDEBAR </ ALIGN=BOTTOM | TOP | LEFT | RIGHT>;GTL-statement(s);

ENDSIDEBAR;

• ALIGN=BOTTOM is the default alignment.

• You can specify up to four SIDEBAR blocks in a LAYOUT DATALATTICE, one foreach of the bottom, top, left, and right sidebar positions.

• The LAYOUT DATALATTICE automatically aligns a sidebar with the layout columnsor rows.

• Only one statement (such as ENTRY or DISCRETELEGEND) or one layout block(such as LAYOUT GRIDDED) is allowed in a SIDEBAR block. To create multi-linetext in a sidebar, nest ENTRY statements within a LAYOUT GRIDDED block.

The following example shows a SIDEBAR block that displays a legend at the top of thelayout grid.

sidebar / align=top; discretelegend 'p' 'a' / across=2; endsidebar;

Example Program and Statement Details 37

Page 48: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Options

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the layout background.

BORDER Specifies whether a border is drawn around thelayout.

BORDERATTRS Specifies the properties of the border line.

CELLHEIGHTMIN Specifies the minimum height of a cell in thegrid.

CELLWIDTHMIN Specifies the minimum width of a cell in thegrid.

COLUMNAXISOPTS Specifies axis options for all columns.

COLUMNDATARANGE Specifies how the X-axes of instances of thegraph-prototype are scaled.

COLUMNGUTTER Specifies the amount of empty space that isbetween the columns.

COLUMNHEADERS Specifies where to position the outside columnheader.

COLUMNS Specifies the number of columns in the layout.

HEADERBACKGROUNDCOLOR Specifies the background color of the cellheaders.

HEADERLABELATTRS Specifies the text properties for the cell headers.

HEADERLABELDISPLAY Indicates whether the automatic cell header textincludes variable name and value or just thevalue.

HEADERLABELLOCATION Indicates whether the cell header is placedwithin each cell (INSIDE) or as row and columnheaders external to the lattice (OUTSIDE).

HEADEROPAQUE Specifies whether the background for the cellheaders is opaque.

INSET Specifies what information is displayed in aninset.

INSETOPTS Specifies the location and appearance optionsfor the inset information.

OPAQUE Specifies whether the layout background isopaque.

38 Chapter 4 • LAYOUT DATALATTICE Statement

Page 49: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

PAD Specifies the amount of extra space that isadded inside the layout border.

PANELNUMBER Specifies the number of the panel to produce.

ROWAXISOPTS Specifies axis options for all rows.

ROWDATARANGE Specifies how the Y-axes of instances of thegraph-prototype are scaled.

ROWGUTTER Specifies amount of empty space between therows.

ROWHEADERS Specifies where to position the outside rowheader.

ROWS Specifies the number of rows in the layout.

SKIPEMPTYCELLS Specifies whether the external axes skip theempty cells in a partially filled grid.

START Indicates whether to start populating the gridfrom the top left or bottom left corner.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the layout background.

Default: The GraphBackground:Color style reference.

style-elementA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is drawn around the layout.

Default: FALSE

Interaction: If this option is set to FALSE, the BORDERATTRS option is ignored.

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the layout. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

CELLHEIGHTMIN=dimensionspecifies the minimum height of a cell in the grid.

Default: 100px

Example Program and Statement Details 39

Page 50: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Use this option in conjunction with the CELLWIDTHMIN= option to set the minimumcell size.

The overall size of the panel is constrained by the HEIGHT= and WIDTH= options inthe ODS GRAPHICS statement. As the number of cells in the grid increases, the sizeof each cell decreases. At some point the cell becomes so small that a meaningful graphcannot be rendered. This option sets the minimum height threshold for all cells. If theactual cell height becomes smaller, no panel is drawn.

CELLWIDTHMIN=dimensionspecifies the minimum width of a cell in the grid.

Default: 100px

Use this option in conjunction with the CELLHEIGHTMIN= option to set the minimumcell size.

The overall size of the panel is constrained by the HEIGHT= and WIDTH= options inthe ODS GRAPHICS statement. As the number of cells in the grid increases, the sizeof each cell decreases. At some point the cell becomes so small that a meaningful graphcannot be rendered. This option sets the minimum width threshold for all cells. If theactual cell width becomes smaller, no panel is drawn.

COLUMNAXISOPTS=(axis-options)specifies X-axis options for all columns. For a list of options, see “Axis Options forLAYOUT DATALATTICE/DATAPANEL”.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

COLUMNDATARANGE=UNIONALL | UNIONspecifies how the X-axes of instances of the graph-prototype are scaled.

Default: UNIONALL

UNIONALLscales the X-axis data ranges across all layout columns and panels (whenPANELNUMBER= is in effect).

UNIONscales the X-axis data ranges separately for each column on a per-panel basis. Thescaling does not span across multiple panels.

Use the COLUMNAXISOPTS= option to control shared axis features.

Use the PANELNUMBER= option for a discussion of how to create multiple panels.

COLUMNGUTTER=dimensionspecifies the amount of empty space that is between the columns.

Default: 0

If there are n columns, then there are n-1 gutters.

COLUMNHEADERS=TOP | BOTTOM | BOTHspecifies where to position the outside column header.

Default: TOP

TOPspecifies that column header text appears at the top of the layout.

BOTTOMspecifies that column header text appears at the bottom of the layout.

40 Chapter 4 • LAYOUT DATALATTICE Statement

Page 51: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

BOTHspecifies that column header text alternates between the top and bottom of the layoutcolumn by column.

Interaction: HEADERLABELLOCATION=OUTSIDE must be set for this option tohave any effect.

COLUMNS=integerspecifies the number of columns in the layout.

Default:

• If this option is not specified, the number of columns is dynamically adjusted toequal the number of classifier values for the COLUMVAR= variable.

• If this option is specified, that many columns are created. If the number ofCOLUMNVAR classifier values is greater than the specified number of columns,no graph is created for some classifier values. If the number of classifier values issmaller than the specified number of columns, extra empty columns are created.

Interaction: The overall grid size is constrained by the HEIGHT= and WIDTH=options in the ODS GRAPHICS statement. As the grid size grows, the cell size shrinks.To control the minimum size of a cell use the CELLHEIGHTMIN= andCELLWIDTHMIN= options.

The START= option affects the how the columns are populated.

The PANELNUMBER= option enables you to create multiple smaller grids thatcompletely partition the classifier values.

HEADERBACKGROUNDCOLOR=style-reference | colorspecifies the background color of the cell headers.

Default: The GraphHeaderBackground:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: HEADEROPAQUE=TRUE must be in effect for the color to be seen.

HEADERLABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the data labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

HEADERLABELDISPLAY=NAMEVALUE | VALUEindicates whether the automatic cell header text includes variable name and value orjust the value.

Default: NAMEVALUE

Example: If the classification variables were Country and Product,HEADERLABEL=NAMEVALUE would produce cell headers such as

Country=CANADA Product=TABLE

HEADERLABEL=VALUE would produce

CANADA TABLE

Example Program and Statement Details 41

Page 52: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

HEADERLABELLOCATION=OUTSIDE | INSIDEindicates whether the cell header is placed within each cell (INSIDE) or as row andcolumn headers external to the lattice (OUTSIDE).

Default: OUTSIDE

HEADEROPAQUE=booleanspecifies whether the background for cell headers is opaque (TRUE) or transparent(FALSE).

Default: TRUE

Interaction: When this option is set to FALSE, the background color for cell headersis not used.

INSET=(variable-list)specifies what information is displayed in an inset. The variable-list defines one ormore variables whose names and values appear as a small table in the data cells. Thevariables can be either numeric or character. Variable names are separated by spaces.

Default: no default

Restriction: No predefined information is available for the inset. You must create thedesired inset information as part of your input data. This is most typically done asfollows (see the chapter on classification panels and the chapter on insets in theSAS/GRAPH Graph Template Language User’s Guide for complete examples):

• Create a separate data set for the inset columns making sure that the column namesare different from the other columns used in graph. The number observations ofinset data should match the number of cells in the classification panel. The orderingof the inset observations should be the same as population order of the cells of theclassification panel taking into account the ROWVAR= and COLUMNVAR=arguments and the START= option. Typically, the number of observations for theinset data is smaller than the other input data for the graph.

• Merge the inset data set with the data set for the graph using a DATA or PROCSQL step. Do not match-merge the observations of the two data sets (no BYprocessing). The resulting data set typically has the inset columns padded withmissing values.

• Use the merged data set to produce the graph, specifying the inset column namesin this option’s variable-list.

The variable values are associated with the data cells by data order. That is, the firstobservation from all the variables in variable-list are used in the first data cell, thesecond observation from all variables in variable-list are used in the second data cell,and so on. If a value is missing for an observation, the corresponding name-value pairis skipped in the affected data cell.

The location and appearance of the inset is controlled by the INSETOPTS= option.

INSETOPTS=(appearance-options)specifies location and appearance options for the inset information.

The appearance-options can be any one or more of the settings that follow. The optionsmust be enclosed in parentheses, and each option is specified as a name = value pair.

AUTOALIGN=NONE | AUTO | (location-list)specifies whether the inset is automatically aligned within the layout.

Default: NONE

42 Chapter 4 • LAYOUT DATALATTICE Statement

Page 53: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

NONE Do not automatically align this inset. Thisinset’s position is set by the HALIGN=and VALIGN= appearance-options.

AUTO Attempt to center this inset in the area thatis farthest from any surrounding markers.Data cells might have different insetplacements.

(location-list) Restrict this inset’s possible locations tothose locations in the specified location-list, and use the location-list position thatleast collides with the data cell’s othergraphics features. The location-list isblank-separated and can contain any ofthese locations: TOPLEFT TOPTOPRIGHT LEFT CENTER RIGHTBOTTOMLEFT BOTTOMBOTTOMRIGHT. Example:AUTOALIGN = (TOPRIGHTTOPLEFT)

Interaction: When AUTOALIGN=AUTO or (location-list), the HALIGN= andVALIGN= are ignored.

BACKGROUNDCOLOR= style-reference | colorspecifies the color of the inset background

Default: The background is transparent. No color is assigned.

style-reference A reference of the form style-element :style-attribute. Only the style-attributenamed COLOR is used.

BORDER= booleanspecifies whether a border is displayed around the inset.

Default: FALSE

HALIGN=LEFT | CENTER | RIGHTspecifies the horizontal alignment of the inset.

Default: LEFT

Interaction: This option is ignored unless AUTOALIGN=NONE.

OPAQUE= booleanspecifies whether the inset background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When OPAQUE=FALSE, the background color is not used.

TEXTATTRS=style-element | style-element (text-options) | (text-options)specifies the text properties of the entire inset. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options”on page 566 for available text-options.

Default: The GraphDataText style element.

VALIGN=TOP | CENTER |BOTTOMspecifies the vertical alignment of the inset.

Default: TOP

Example Program and Statement Details 43

Page 54: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option is ignored unless AUTOALIGN=NONE.

OPAQUE= booleanspecifies whether the layout background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

PAD=dimension | (pad-options)specifies the amount of extra space that is added inside the layout border.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the layout border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

PANELNUMBER=positive-integerspecifies the number of the panel to produce.

Default: 1

This option enables you to partition a large grid into a number of smaller grids underthese conditions:

• You set a grid size explicitly (ROWS= and COLUMNS= when ROWVAR andCOLUMNVAR variables are specified; ROWS= when only a ROWVAR variableis specified; COLUMNS= when only a COLUMNVAR variable is specified)

• The grid size is smaller in one or both of the dimensions of the default dynamicallygenerated grid.

• You execute the template N times and increment the panel number each time. N isdetermined by CEIL(all rows * all columns / grid rows * grid columns).

Example: Suppose ROWVAR=R (R has 10 unique values) and COLUMNVAR=C (Chas 11 unique values). The dynamic grid has 10 rows and 11 columns and you wouldhave to make the HEIGHT=and WIDTH= quite large to enable 110 plots to bedisplayed. By setting some smaller grid size, say ROWS=3 and COLUMNS=4, and bymaking the value of PANELNUMBER= a dynamic or macro variable, you can create10 panels (9 with 12 data cells and 1 with 2 data cells) that collectively display all 110possible crossings. You simply invoke PROC SGRENDER or a DATA step 10 times,incrementing the dynamic value for PANELNUMBER each time.

44 Chapter 4 • LAYOUT DATALATTICE Statement

Page 55: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ROWAXISOPTS=(axis-options)specifies Y-axis options for all rows. For a list of options, see “Axis Options forLAYOUT DATALATTICE/DATAPANEL” on page 467.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

ROWDATARANGE=UNIONALL | UNIONspecifies how the Y-axes of instances of the graph-prototype are scaled.

Default: UNIONALL

UNIONALLscales the Y-axis data ranges across all layout rows and panels (whenPANELNUMBER= is in effect).

UNIONscales the Y-axis data ranges separately for each row in the layout on a per-pagebasis. The scaling does not span across multiple pages.

Use the ROWAXISOPTS= option to control shared axis features.

See the PANELNUMBER= option for a discussion of how to create multiple panels.

ROWGUTTER=dimensionspecifies the amount of empty space between the rows.

Default: 0

If there are n rows, then there are n-1 gutters.

ROWHEADERS=RIGHT | LEFT | BOTHspecifies where to position the outside row header.

Default: RIGHT

RIGHTspecifies that row header appears at the right of the layout.

LEFTspecifies that row header appears at the left of the layout.

BOTHspecifies that row header alternates between the right and left of the layout row byrow.

HEADERLABELLOCATION=OUTSIDE must be set for this option to have anyeffect.

ROWS=integerspecifies the number of rows in the layout.

Default:

• If this option is not specified, the number of rows is dynamically adjusted to equalthe number of classifier values for the ROWVAR= variable.

• If this option is specified, the specified number of rows is created. If the number ofROWVAR classifier values is greater than the specified number of rows, no graphis created for some classifier values. If the number of classifier values is smallerthan the specified number of rows, extra empty rows are created.

Interaction: The overall grid size is constrained by the HEIGHT= and WIDTH=options in the ODS GRAPHICS statement. As the grid size grows, the cell size shrinks.To control the minimum size of a cell use the CELLHEIGHTMIN= andCELLWIDTHMIN= options.

The START= option affects the way the rows are populated.

Example Program and Statement Details 45

Page 56: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The PANELNUMBER= option enables you to create multiple smaller grids thatcompletely partition the classifier values.

SKIPEMPTYCELLS=booleanspecifies whether the external axes skip the empty cells in a partially filled grid.

Default: FALSE

FALSEExternal axes are displayed at their normal locations, even if there are empty cellsat one or more of the locations.

TRUEExternal axes skip empty cells and "snap" to the nearest data cell, both verticallyand horizontally. Though the empty cells are not displayed, the data cells in the gridare not enlarged to fill the area.

Discussion: Whenever the number of unique COLUMNVAR= classifier values (datacells) is not evenly divisible by the COLUMNS= value, or the number of uniqueROWVAR= classifier values (data cells) is not evenly divisible by the ROWS= value,then one or more panels is partially filled with data cells and padded with empty cellsto complete the grid.

In this example, there are 4 column-data cells and 3 row-data cells arranged in a 4-column, 2-row grid. This is default appearance of the last panel:

When SKIPEMPTYCELLS=TRUE, the empty padding cells of all panels are removedand external axis ticks and tick values snap to the data cells:

START=TOPLEFT | BOTTOMLEFTindicates whether to start populating the grid from the top left or bottom left corner.

Default: TOPLEFT

If ROWVAR=R has values in the sort order 1 and 2 and COLUMNVAR=C has valuesin the sort order a and b, then START=BOTTOMLEFT is populated as follows:

46 Chapter 4 • LAYOUT DATALATTICE Statement

Page 57: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

START=TOPLEFT is populated as follows:

Example Program and Statement Details 47

Page 58: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

48 Chapter 4 • LAYOUT DATALATTICE Statement

Page 59: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 5

LAYOUT DATAPANEL Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Required Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Prototype Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52Sidebar Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Description and SyntaxCreates a grid of graphs based on one or more classification variables and a graphicalprototype. By default, a separate instance of the prototype (a data cell) is created for eachactual combination of the classification variables.

LAYOUT DATAPANEL CLASSVARS = (class-var1…class-varN) </option(s)> ;graph-prototype-block;<sidebar-statement-block(s);>

ENDLAYOUT;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 50:

49

Page 60: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThis example shows a four-column, three-row data panel using two classification variables.With this layout, each data cell is subsetted and labeled with the values of the classificationvariables.

• The ROWDATARANGE = UNION option assures that an axis range is computedseparately for each row using the data ranges of all Y= variables in that row. Thisfacilitates the visual comparison of the data cells.

• A SIDEBAR block is used to place the legend at the bottom of the lattice.

proc template; define statgraph layoutdatapanel; begingraph; entrytitle "Annual Furniture Sales Comparisons"; layout datapanel classvars=(country year) / columns=4 rows=3 rowdatarange=union headerlabeldisplay=value headerbackgroundcolor=GraphAltBlock:color rowaxisopts=(display=(tickvalues) griddisplay=on linearopts=(tickvalueformat=dollar12.)) columnaxisopts=(display=(tickvalues) timeopts=(tickvalueformat=monname3.)); layout prototype / cycleattrs=true; seriesplot x=month y=TotalActual / name="Actual"; seriesplot x=month y=TotalPredict / name="Predict"; endlayout; sidebar / align=top; discretelegend "Actual" "Predict" / border=false; endsidebar; endlayout; endgraph;

50 Chapter 5 • LAYOUT DATAPANEL Statement

Page 61: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

end;run;

proc summary data=sashelp.prdsal2 nway; class country year month; var actual predict; output out=prdsal2 sum=TotalActual TotalPredict;run;

proc sgrender data=prdsal2 template=layoutdatapanel;run;

Statement SummaryThe LAYOUT DATAPANEL statement creates a grid of graphs, based on the values ofone or more classifications variables. The main differences between this layout and theDATALATTICE layout is that this layout supports more than two classification variables,and it provides more control over the grid layout.

By default, the number of cells in the layout is determined by a crosstabulation table of allthe classification variables plus any empty cells needed to complete the last row/columnof the grid. The contents of each data cell are based on a graph prototype that you specifyin the graph-prototype-block. You can enhance the display using one or more sidebar-statement-blocks. For classification variables that have many values, you can use theCOLUMNS= option or the ROWS= option, or both with the PANELNUMBER= optionto generate multiple panel displays.

The order of the value pairings for the classification variables is determined by the orderthat the variables are specified on the CLASSVARS= argument. The last named variable’svalues vary most rapidly (like nested DO loops). Variable values are always returned indata order.

By default, the first data cell to be filled is in the layout’s top left corner, and data cells arefilled from left-to-right, top-to-bottom. Use the START= option to change the starting datacell to the bottom left corner, and use the ORDER= option to determine whether data cellsfill by column or by row. See the START= option for illustrations on how START= andORDER= interact to manage the fill sequence for data cells.

Note: The DATAPANEL layout is designed to be the outermost layout in the template.

Required ArgumentCLASSVARS=(class-var1 …class-varN)

specifies a list of classification variables. By default, a data cell is created for eachcrossing of these variables in the input data. The total number of grid cells created isthe result of a crosstabulation table of all the classification variables plus any emptycells needed to complete the last row/column of the grid. You can request that data cellsbe generated for all possible crossings, even when the class variables have no valuesat those crossings. For more information, see the SPARSE= option.

Variable values are always retained in data order. Formats can be assigned to classvariables to create classification levels (for example, an AGEGROUPFMT. format fornumeric AGE).

The output size does not grow automatically as the number of cells increases. To set apanel size for the current template, use the DESIGNHEIGHT= and DESIGNWIDTH=options in the BEGINGRAPH statement. To set a panel size for all templates in the

Example Program and Statement Details 51

Page 62: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

current SAS session, use the HEIGHT= and WIDTH= options in the ODS GRAPHICSstatement. Size settings in the ODS GRAPHICS statement override size settings in theBEGINGRAPH statement. The default output width is 640px, and the default outputheight is 480px.

As the number of cells in the grid increases, the size of each cell decreases. At somepoint the cells might become so small that a meaningful graph cannot be rendered. TheCELLHEIGHTMIN= and CELLWIDTHMIN= options set a threshold for the smallestcell. If the actual cell height or width becomes smaller, no panel is drawn. The defaultminimum cell size is CELLHEIGHTMIN=100px and CELLWIDTHMIN=100px.

Using the default panel size and cell size, the DATAPANEL layout accommodates agrid of about 24 cells (6 columns by 4 rows). If you know that the number of cells islarger, you should increase the overall panel size, or decrease the minimum cell size,or both. You can also use ROWS=, COLUMNS=, and PANELNUMBER= options topartition your data so a number of smaller grids are produced that cumulatively showall of the value crossings.

Prototype BlockYou must specify a single graph-prototype-block within the LAYOUT DATAPANELblock, using the following syntax:

LAYOUT PROTOTYPE </option(s)>;GTL-statements;

ENDLAYOUT;

The graph-prototype-block determines the graphical content of each data cell and isrepeated within each data cell, based on the subsets of the classification variables.

For more information about the LAYOUT PROTOTYPE block and the list of availableoptions, see “LAYOUT PROTOTYPE Statement” on page 109.

Sidebar BlocksA LAYOUT DATAPANEL enables you to display sidebars outside of the axis areas. Asidebar spans across columns or rows and is useful for displaying information that appliesto all of the columns or all of the rows. For example, sidebars are useful for displaying alegend.

A SIDEBAR statement has the following syntax:

SIDEBAR </ ALIGN= BOTTOM | TOP | LEFT | RIGHT >;GTL-statement(s);

ENDSIDEBAR;

• ALIGN=BOTTOM is the default alignment.

• You can specify up to four SIDEBAR blocks in a LAYOUT DATAPANEL, one foreach of the bottom, top, left, and right sidebar positions.

• The LAYOUT DATAPANEL automatically aligns a sidebar with the layout columnsor rows.

• Only one statement (such as ENTRY or DISCRETELEGEND) or one layout block(such as LAYOUT GRIDDED) is allowed in a SIDEBAR block. To create multi-linetext in a sidebar, nest ENTRY statements within a LAYOUT GRIDDED block.

52 Chapter 5 • LAYOUT DATAPANEL Statement

Page 63: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The following example shows a SIDEBAR block that displays a legend at the top of thelayout grid.

sidebar / align=top; discretelegend 'p' 'a' / across=2; endsidebar;

Options

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the layout background.

BORDER Specifies whether a border is drawn around thelayout.

BORDERATTRS Specifies the properties of the border line.

CELLHEIGHTMIN Specifies the minimum height of a cell in thegrid.

CELLWIDTHMIN Specifies the minimum width of a cell in thegrid.

COLUMNAXISOPTS Specifies axis options for all columns.

COLUMNDATARANGE Specifies how the X-axes of instances of thegraph-prototype are scaled.

COLUMNGUTTER Specifies the amount of empty space that isbetween the columns.

COLUMNS Specifies the number of columns in the layout.

HEADERBACKGROUNDCOLOR Specifies the background color of the cellheaders.

HEADERLABELATTRS Specifies the text properties for the cell headers.

HEADERLABELDISPLAY Indicates whether the automatic cell header textincludes variable name and value or just thevalue.

HEADEROPAQUE Specifies whether the background for the cellheaders is opaque.

INSET Specifies what information is displayed in aninset.

INSETOPTS Specifies the location and appearance optionsfor the inset information.

OPAQUE Specifies whether the layout background isopaque.

Example Program and Statement Details 53

Page 64: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

ORDER Specifies whether cells are populated bycolumn priority or by row priority.

PAD Specifies the amount of extra space that isadded inside the layout border.

PANELNUMBER Specifies the number of the panel to produce.

ROWAXISOPTS Specifies axis options for all rows.

ROWDATARANGE Specifies how the Y-axes of instances of thegraph-prototype are scaled.

ROWGUTTER Specifies amount of empty space between therows.

ROWS Specifies the number of rows in the layout.

SKIPEMPTYCELLS Specifies whether the external axes skip theempty cells in a partially filled grid.

SPARSE Specifies whether crossings of the classvariables include only the crossing in the dataor all possible crossings.

START Indicates whether to start populating the datacells from the top left or bottom left corner.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the layout background.

Default: The GraphBackground:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE= TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is drawn around the layout.

Default: FALSE

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the layout. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

CELLHEIGHTMIN=dimensionspecifies the minimum height of a cell in the grid.

Default: 100px

54 Chapter 5 • LAYOUT DATAPANEL Statement

Page 65: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Use this option in conjunction with the CELLWIDTHMIN= option to set the minimumcell size.

The overall size of the panel is constrained by the HEIGHT= and WIDTH= options inthe ODS GRAPHICS statement. As the number of cells in the grid increases, the sizeof each cell decreases. At some point the cell becomes so small that a meaningful graphcannot be rendered. This option sets the minimum height threshold for all cells. If theactual cell height becomes smaller, no panel is drawn.

CELLWIDTHMIN=dimensionspecifies the minimum width of a cell in the grid.

Default: 100px

Use this option in conjunction with the CELLHEIGHTMIN= option to set the minimumcell size.

The overall size of the panel is constrained by the HEIGHT= and WIDTH= options inthe ODS GRAPHICS statement. As the number of cells in the grid increases, the sizeof each cell decreases. At some point the cell becomes so small that a meaningful graphcannot be rendered. This option sets the minimum width threshold for all cells. If theactual cell width becomes smaller, no panel is drawn.

COLUMNAXISOPTS=(axis-options)specifies X-axis options for all columns. For a list of options, see “Axis Options forLAYOUT DATALATTICE/DATAPANEL” on page 467.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

COLUMNDATARANGE=UNIONALL | UNIONspecifies how the X-axes of instances of the graph-prototype are scaled.

Default: UNIONALL

UNIONALLscales the X-axis data ranges across all layout columns and panels (whenPANELNUMBER= is in effect).

UNIONscales the X-axis data ranges separately for each column on a per-panel basis. Thescaling does not span across multiple panels.

Use the COLUMNAXISOPTS= option to control shared axis features.

See the PANELNUMBER= option for a discussion of how to create multiple panels.

COLUMNGUTTER=dimensionspecifies the amount of empty space that is between the columns.

Default: 0

If there are n columns, then there are n-1 gutters.

COLUMNS=integerspecifies the number of columns in the layout.

Default:

• If this option is not specified and ROWS= is specified, the number of data cells(and columns) increases dynamically to allow all classifier values to bepresented.

• If both this option and ROWS= are specified, a grid of that size is created, regardlessof the number of classifier values. If the number of classifier values is greater thanthe grid size, no graphs is created for some classifier values. If the number of

Example Program and Statement Details 55

Page 66: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

classifier values is small and the grid size large, there might be empty cellscreated.

Interaction: The overall grid size is constrained the HEIGHT= and WIDTH= optionsin the ODS GRAPHICS statement. As the grid size grows, the cell size shrinks. Tocontrol the minimum size of a cell use the CELLHEIGHTMIN= andCELLWIDTHMIN= options.

The START= and ORDER= options affect the how the rows are populated.

The PANELNUMBER= option enables you to create multiple smaller grids thatcompletely partition the classifier values.

HEADERBACKGROUNDCOLOR=style-reference | colorspecifies the background color of the cell headers.

Default: The GraphHeaderBackground:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: HEADEROPAQUE=TRUE must be in effect for the color to be seen.

HEADERLABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the data labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

HEADERLABELDISPLAY=NAMEVALUE | VALUEindicates whether the automatic cell header text includes variable name and value orjust the value.

Default: NAMEVALUE

Example: If the classification variables were Country and Product,HEADERLABEL=NAMEVALUE would produce cell headers such as

Country=CANADA Product=TABLE

and HEADERLABEL=VALUE would produce

CANADA TABLE

HEADEROPAQUE=booleanspecifies whether the background for cell headers is opaque (TRUE) or transparent(FALSE).

Default: TRUE

Interaction: When this option is set to FALSE, the background color for cell headersis not used.

INSET=(variable-list)specifies what information is displayed in an inset. The variable-list defines one ormore variables whose names and values appear as a small table in the data cells. Thevariables can be either numeric or character. Variable names are separated by spaces.

Default: no default

56 Chapter 5 • LAYOUT DATAPANEL Statement

Page 67: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: No predefined information is available for the inset. You must create thedesired inset information as part of your input data. This is most typically done asfollows (see the chapter on classification panels and the chapter on insets in theSAS/GRAPH Graph Template Language User’s Guide for complete examples):

• Create a separate data set for the inset columns making sure that the column namesare different from the other columns used in graph. The number observations ofinset data should match the number of cells in the classification panel. The orderingof the inset observations should be the same as population order of the cells of theclassification panel, taking into account the CLASSVARS= argument and theORDER= and START= options. Typically, the number of observations for the insetdata is smaller than the other input data for the graph.

• Merge the inset data set with the data set for the graph using a DATA or PROCSQL step. Do not match-merge the observations of the two data sets (no BYprocessing). The resulting data set typically has the inset columns padded withmissing values.

• Use the merged data set to produce the graph, specifying the inset column namesin this option’s variable-list.

The variable values are associated with the data cells by data order. That is, the firstobservation from all the variables in variable-list are used in the first data cell, thesecond observation from all variables in variable-list are used in the second data cell,and so on. If a value is missing for an observation, the corresponding name-value pairis skipped in the affected data cell.

The location and appearance of the inset is controlled by the INSETOPTS= option.

INSETOPTS=(appearance-options)specifies location and appearance options for the inset information.

The appearance-options can be any one or more of the settings that follow. The optionsmust be enclosed in parentheses, and each option is specified as a name = value pair.

AUTOALIGN=NONE | AUTO | (location-list)specifies whether the inset is automatically aligned within the layout.

Default: NONE

NONE Do not automatically align this inset. Thisinset’s position is set by the HALIGN=and VALIGN= appearance-options.

AUTO Attempt to center this inset in the area thatis farthest from any surrounding markers.Data cells might have different insetplacements.

(location-list) Restrict this inset’s possible locations tothose locations in the specified location-list, and use the location-list position thatleast collides with the data cell’s othergraphics features. The location-list isblank-separated and can contain any ofthese locations: TOPLEFT TOPTOPRIGHT LEFT CENTER RIGHTBOTTOMLEFT BOTTOMBOTTOMRIGHT. Example:AUTOALIGN = (TOPRIGHTTOPLEFT)

Example Program and Statement Details 57

Page 68: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: When AUTOALIGN=AUTO or (location-list), the HALIGN= andVALIGN= appearance-options are ignored.

BACKGROUNDCOLOR= style-reference | colorspecifies the color of the inset background

Default: The background is transparent. No color is assigned.

style-reference A reference of the form style-element :style-attribute. Only the style-attributenamed COLOR is used.

BORDER= booleanspecifies whether a border is displayed around the inset.

Default: FALSE

HALIGN=LEFT | CENTER | RIGHTspecifies the horizontal alignment of the inset.

Default: LEFT

Interaction: This option is ignored unless AUTOALIGN=NONE.

OPAQUE= booleanspecifies whether the inset background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When OPAQUE=FALSE, the background color is not used.

TEXTATTRS=style-element | style-element (text-options) | (text-options)specifies the text properties of the entire inset. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options”on page 566 for available text-options.

Default: The GraphDataText style element.

VALIGN=TOP | CENTER |BOTTOMspecifies the vertical alignment of the inset.

Default: TOP

Interaction: This option is ignored unless AUTOALIGN=NONE.

OPAQUE= booleanspecifies whether the layout background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

ORDER=ROWMAJOR | COLUMNMAJORspecifies whether data cells are populated by column priority or by row priority.

Default: ROWMAJOR

COLUMNMAJORfills the data cells by columns, from the starting position.

ROWMAJORfills the data cells by rows, from the starting position.

PACKEDfills all pages in ROWMAJOR order, using START=TOPLEFT. When the last pageis reached and it is a partial page (fewer than ROWS*COLUMNS), the number ofrows and columns of cells is adjusted, based on an internal algorithm.

58 Chapter 5 • LAYOUT DATAPANEL Statement

Page 69: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: The starting point for rendering data cells is controlled by the START=option. See the START= option for examples.

PAD=dimension | (pad-options)specifies the amount of extra space that is added inside the layout border.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the layout border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

PANELNUMBER=positive-integerspecifies the number of the panel to produce.

Default: 1

This option enables you to partition a large grid into a number of smaller sized gridsunder these conditions:

• You set a grid size explicitly ( ROWS= and COLUMNS= options).

• The grid size (gridrows x gridcolumns) is smaller than the total number ofclassifier levels.

• You execute the template N times and increment the panel number each time. N isdetermined by CEIL(total-classification-levels / gridrows xgridcolumns).

Example: Suppose there are two classifiers (CLASS1 has 10 unique values andCLASS2 has 11 unique values). By setting some smaller grid size, say ROWS=3 andCOLUMNS=4, and making the value of PANELNUMBER= a dynamic or macrovariable, you can create 10 panels (9 panels with 12 data cells and 1 panel with 2 datacells) that collectively display all 110 possible crossings. You simply invoke PROCSGRENDER or a DATA step 10 times, incrementing the dynamic value forPANELNUMBER each time.

ROWAXISOPTS=(axis-options)specifies Y-axis options for all rows. For a list of options, see “Axis Options forLAYOUT DATALATTICE/DATAPANEL” on page 467.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

Example Program and Statement Details 59

Page 70: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ROWDATARANGE=UNIONALL | UNIONspecifies how the Y-axes of instances of the graph-prototype are scaled.

Default: UNIONALL

UNIONALLscales the Y-axis data ranges across all layout rows and panels (whenPANELNUMBER= is in effect).

UNIONscales the Y-axis data ranges separately for each row in the layout on a per-pagebasis. The scaling does not span across multiple pages.

Use the ROWAXISOPTS= option to control shared axis features.

See the PANELNUMBER= option for a discussion of how to create multiple panels.

ROWGUTTER=dimensionspecifies the amount of empty space that is before the first row, between the rows, andafter the last row.

Default: 0

If there are n rows, then there are n-1 gutters.

ROWS=integerspecifies the amount of empty space between the rows.

Default:

• If this option is not specified and COLUMNS= is specified, the number of datacells (and rows) increases dynamically to allow all classifier values to bepresented.

• If both this option and COLUMNS= are specified, a grid of that size is created,regardless of the number of classifier values. If the number of classifier values isgreater than the grid size, no graphs is created for some classifier values. If thenumber of classifier values is small and the grid size large, there might be emptycells created.

Interaction: The overall grid size is constrained the HEIGHT= and WIDTH= optionsin the ODS GRAPHICS statement. As the grid size grows, the cell size shrinks. Tocontrol the minimum size of a cell use the CELLHEIGHTMIN= andCELLWIDTHMIN= options.

The START= and ORDER= options affect the way the rows are populated.

The PANELNUMBER= option enables you to create multiple smaller grids thatcompletely partition the classifier values.

SKIPEMPTYCELLS=booleanspecifies whether the external axes skip the empty cells in a partially filled grid.

Default: FALSE

FALSEExternal axes are displayed at their normal locations, even if there are empty cellsat one or more of the locations.

TRUEExternal axes skip empty cells and "snap" to the nearest data cell, both verticallyand horizontally. Though the empty cells are not displayed, the data cells in the gridare not enlarged to fill the area.

60 Chapter 5 • LAYOUT DATAPANEL Statement

Page 71: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Discussion: Whenever the total number of classifier crossings (data cells) is not evenlydivisible by the panel size (columns * rows), the last panel is partially filled with datacells and padded with empty cells to complete the grid.

In this example, there are 16 data cells arranged in a 4-column, 3-row grid. This isdefault appearance of the last panel:

When SKIPEMPTYCELLS=TRUE, the empty padding cells of the last panel areremoved and external axis ticks and tick values snap to the data cells:

Note that SKIPEMPTYCELLS=TRUE removes only the empty padding cells on thelast panel. It does not remove any data cells that have no crossing values and thereforeno graph (these data cells are displayed when SPARSE=TRUE).

SPARSE=booleanSpecifies whether crossings of the class variables include only the crossings in the dataor all possible crossings.

Default: FALSE

FALSEData cells are created only for crossings of the class variables that are in the data.

TRUEThe number of data cells is the product of the unique values for each classificationvariable.

By default, if a crossing of the class variables has a missing value as part of the data, adata cell is created for it.

Discussion: In this example, the classification variables are COUNTRY and STATE.There are 3 distinct values of COUNTRY (Canada, Mexico, and U.S.A.) WithinCanada and Mexico there are 4 states, and within U.S.A. there are 8 states. All statenames are unique to each country. Therefore, there are 16 unique STATE values and

Example Program and Statement Details 61

Page 72: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

48 unique crossings of COUNTRY and STATE, but there are data for only 16 of thecrossings.

Assume that a data panel layout is created with COLUMNS=6 and SPARSE=TRUE,meaning to display all possible crossings. This is what the first row would look like,with blank data cells being added whenever there are no data values for a crossing:

When SPARSE=FALSE the crossings of the classifiers with no data are automaticallyremoved. This compacts the display:

START=TOPLEFT | BOTTOMLEFTindicates whether to start populating the grid cells from the top left or bottom left corner.

Default: TOPLEFT

Interaction: If ORDER=ROWMAJOR (the default) and START=TOPLEFT (thedefault), a 2 row 2 column grid is populated as

cell 1 cell 2

cell 3 cell 4

If ORDER=ROWMAJOR (the default) and START=BOTTOMLEFT, a 2 row 2column grid is populated as

cell 3 cell 4

cell 1 cell 2

If ORDER=COLUMNMAJOR and START=BOTTOMLEFT, a 2 row 2 column gridis populated as

cell 2 cell 4

cell 1 cell 3

62 Chapter 5 • LAYOUT DATAPANEL Statement

Page 73: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

If ORDER=COLUMNMAJOR and START=TOPLEFT, a 2 row 2 column grid ispopulated as

cell 1 cell 3

cell 2 cell 4

Example Program and Statement Details 63

Page 74: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

64 Chapter 5 • LAYOUT DATAPANEL Statement

Page 75: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 6

LAYOUT GRIDDED Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

Description and SyntaxAssembles the results of nested GTL-statements into a grid.

LAYOUT GRIDDED </option(s)>GTL-statements;

ENDLAYOUT;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 66:

65

Page 76: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThe GRIDDED layout offers the best way to nest a table of information inside anotherlayout. In the GRIDDED layout, you can control the content, text justification, and fontsof columns. Because this example nests the GRIDDED layout within an OVERLAY layout,you can control where it appears within the plot area. The AUTOALIGN= option enablesyou to specify a prioritized list of possible positions where the layout should be drawn. Theposition actually used is the first one that avoids collision with the histogram. Also, theGRIDDED layout is set to be opaque so that the grid lines do not show through.

This example also illustrates a reusable template in the sense that it works for any numericvariable specified by the dynamic variable VAR. Also, SGE functions for computing theN, MEAN, STDDEV of the variable are used in the table to compute the statistics as thetemplate is executed.

proc template; define statgraph inset; dynamic VAR; begingraph; entrytitle "Distribution of " VAR; layout overlay / yaxisopts=(griddisplay=on); histogram VAR / scale=percent; layout gridded / columns=2 autoalign=(topleft topright) border=true opaque=true backgroundcolor=GraphWalls:color; entry halign=left "N"; entry halign=left eval(strip(put(n(VAR),12.0))); entry halign=left "Mean"; entry halign=left eval(strip(put(mean(VAR),12.2))); entry halign=left "Std Dev"; entry halign=left eval(strip(put(stddev(VAR),12.2))); endlayout;

66 Chapter 6 • LAYOUT GRIDDED Statement

Page 77: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=inset; dynamic VAR="Weight";run;

Statement SummaryA GRIDDED layout is commonly used to create small tables of text that are nested withinother layouts. The layout might also be used to span and center a single entry (a legend,for example) across a set of grids. Or it might be used to display a grid of graphs whenthere is no need to scale axis data ranges or align graphs across grid cells.

The GRIDDED layout automatically decides how much area to allocate to cell contents:

• text items have a fixed size based on the amount of text and the font properties

• graphs take up the remaining space.

The layout’s grid size is determined by the COLUMNS= and ROWS= options. Theresulting columns and rows can be separated by areas called “gutters”, which are controlledby the COLUMNGUTTER= and ROWGUTTER= options.

By default, the results of the GTL-statements are placed into the grid sequentially from leftto right, wrapping to a new row each time the current row is filled. You can use theORDER= option to fill cells from top to bottom down a column. In that case, the layoutcells wrap to a new column each time the current column is filled.

Options

Statement Option Description

AUTOALIGN Specifies whether this layout is automaticallyaligned within its parent when nested within anoverlay-type layout.

BACKGROUNDCOLOR Specifies the color of the layout background.

BORDER Specifies whether a border is drawn around thelayout.

BORDERATTRS Specifies the properties of the border line.

COLUMNGUTTER Specifies the amount of empty space betweenthe columns.

COLUMNS Specifies the number of columns in the layout.

HALIGN Specifies this layout’s horizontal alignmentwithin its parent when nested within an overlay-type layout.

Example Program and Statement Details 67

Page 78: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

LOCATION Specifies whether the layout appears inside oroutside the plot area when nested within anoverlay-type layout.

OPAQUE Specifies whether the layout background isopaque.

ORDER Specifies whether cells are populated usingcolumn priority or row priority.

PAD Specifies the amount of extra space that isadded inside the layout border.

ROWGUTTER Specifies the amount of empty space betweenthe rows.

ROWS Specifies the number of rows in the layout.

VALIGN Specifies this layout’s vertical alignment withinits parent when nested within an overlay-typelayout.

AUTOALIGN=NONE | AUTO | (location-list)specifies whether this layout is automatically aligned within its parent when nestedwithin an overlay-type layout. For more information about how child positions aredetermined in an overlay-type layout, see the LAYOUT OVERLAY’s “ExampleProgram and Statement Details” on page 89.

Default: NONE

NONEDo not automatically align this layout within its parent layout. This layout’s positionwithin its parent layout is therefore set by the HALIGN= and VALIGN= options.

AUTOAvailable only if the parent layout contains a scatter plot; ignored otherwise. Withinthe parent layout, attempt to center this layout in the area that is farthest from anysurrounding data point markers.

(location-list)Within the parent layout, restrict this layout’s possible locations to those locationsin the specified location-list, and use the location-list position that least collideswith the parent layout’s other graphics features. The location-list is blank-separatedand can contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT,CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.

Restriction: This option is available only when this layout statement is nested withinan overlay-type layout. This option is ignored if this statement is the outermost layoutor if the parent layout is not an overlay-type layout.

Interaction: If this option is enabled, it overrides the HALIGN= and VALIGN=options.

Interaction: This option is ignored if LOCATION=OUTSIDE.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the layout background.

68 Chapter 6 • LAYOUT GRIDDED Statement

Page 79: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: The GraphBackground:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is drawn around the layout.

Default: FALSE

Interaction: If this option is set to FALSE, the BORDERATTRS option is ignored.

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the layout. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

COLUMNGUTTER=dimensionspecifies the amount of empty space between the columns.

Default: 0

If there are n columns, then there are n-1 gutters.

COLUMNS=integerspecifies the number of columns in the layout.

Default: If ORDER=ROWMAJOR, the default is 1. If ORDER=COLUMNMAJOR,as many columns are created as needed to satisfy the ROWS= request.

Restriction: Assuming ORDER=ROWMAJOR, if COLUMNS=n and there are m cellsdefined, and n > m, then only m columns are created (there are n - m cells with zerosize).

This option is used to create a grid with a fixed number of columns, without concernfor how many rows. For example, the following settings ensure that columns 1 and 2in the first row are filled with content, as shown in the figure:

layout gridded / columns=2 order=rowmajor border=true ; entry '1' /border=true; entry '2' /border=true; entry '3' /border=true;endlayout;

HALIGN=CENTER | LEFT | RIGHTspecifies this layout’s horizontal alignment within its parent when nested within anoverlay-type layout. For more information about how child positions are determinedin an overlay-type layout, see the LAYOUT OVERLAY’s “Example Program andStatement Details” on page 89.

Default: CENTER

Example Program and Statement Details 69

Page 80: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: This option is available only when this statement is nested within anoverlay-type layout. It is ignored if this statement is the outermost layout or if the parentlayout is not an overlay-type layout.

Interaction: If the AUTOALIGN= option is enabled, this option is ignored.

LOCATION=INSIDE | OUTSIDEspecifies whether the legend appears inside or outside the plot area when nested withinan overlay-type layout.

Default: INSIDE

Restriction: This option has effect only when the GRIDDED layout block appearswithin an overlay-type layout. For more information about how child positions aredetermined in an overlay-type layout, see the LAYOUT OVERLAY’s “ExampleProgram and Statement Details” on page 89.

Interaction: The actual position is determined by this option’s setting plus the settingsfor the AUTOALIGN= or HALIGN= and VALIGN= options.

OPAQUE= booleanspecifies whether the layout background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

ORDER=ROWMAJOR | COLUMNMAJORspecifies whether cells are populated using column priority or by row priority.

Default: ROWMAJOR

ROWMAJORfills all the columns in a row, from left to right, before going to the next row.

COLUMNMAJORfills all the rows in a column, from top to bottom, before going to the next column.

Requirement: When this option is set to COLUMNMAJOR, the ROWS= option mustbe specified to indicate how many rows to fill before wrapping to the next column. Thedefault number of rows is 1.

Requirement: When this option is set to ROWMAJOR, the COLUMNS= option mustbe specified to indicate how many columns to fill before wrapping to the next row. Thedefault number of columns is 1.

Interaction: The ROWS= option is ignored when ORDER=ROWMAJOR. TheCOLUMNS= option is ignored when ORDER=COLUMNMAJOR.

PAD=dimension | (pad-options)specifies the amount of extra space that is added inside the layout border.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the layout border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

70 Chapter 6 • LAYOUT GRIDDED Statement

Page 81: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

ROWGUTTER= dimensionspecifies the amount of empty space between the rows.

Default: 0

If there are n rows, then there are n-1 gutters.

ROWS=integerspecifies the number of rows in the layout.

Default: If ORDER=COLUMNMAJOR, the default is 1. If ORDER=ROWMAJOR,this option is ignored and as many rows are created as needed to satisfy theCOLUMNS= request.

Restriction: Assuming ORDER=COLUMNMAJOR, if ROWS=n and there are m cellsdefined, and n > m, then only m rows are created (there are n - m cells with zero size).

This option is used to create a grid with a fixed number of rows, without concern forhow many columns. For example, the following settings ensure that rows 1 and 2 inthe first column are filled with content, as shown in the figure:

layout gridded / rows=2 order=columnmajor border=true ; entry '1' /border=true; entry '2' /border=true; entry '3' /border=true;endlayout;

VALIGN=CENTER | TOP | BOTTOMspecifies this layout’s vertical alignment within its parent when nested within anoverlay-type layout. For more information about how child positions are determinedin an overlay-type layout, see the LAYOUT OVERLAY’s “Example Program andStatement Details” on page 89.

Default: CENTER

Restriction: This option is available only when this statement is nested within anoverlay-type layout. It is ignored if this statement is the outermost layout or if the parentlayout is not an overlay-type layout.

Interaction: If the AUTOALIGN= option is enabled, this option is ignored.

Example Program and Statement Details 71

Page 82: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

72 Chapter 6 • LAYOUT GRIDDED Statement

Page 83: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 7

LAYOUT LATTICE Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75Cell Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77Axis Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Header Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81Sidebar Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Description and SyntaxCreates a grid of graphs that automatically aligns plot areas and tick display areas acrossgrid cells to facilitate data comparisons among graphs.

LAYOUT LATTICE </option(s)>;GTL-statement(s) | cell-statement-block(s);<axis-statement-block(s);><header-statement-block(s);><sidebar-statement-block(s);>

ENDLAYOUT;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 74:

73

Page 84: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThis example shows a two-cell lattice layout (two columns, one row). The ROWAXESblock makes the primary and secondary Y axes external to both cells. The secondary Yaxis is displayed on the right.

• The ROWDATARANGE = UNION option assures that the data ranges of all Y=variables in the row cells are considered to construct a common axis range. Thisfacilitates the visual comparison of the cells.

• A SIDEBAR block is used to place the legend at the top of the lattice.

proc template; define statgraph layoutlattice; begingraph; entrytitle "Vehicle Gas Mileage"; entryfootnote "Averages of 428 models from 38 manufactures"; layout lattice / columns=2 rowdatarange=union; layout overlay / cycleattrs=true; barchart x=origin y=mpg_highway / stat=mean barwidth=.8 name="H" ; barchart x=origin y=mpg_city / stat=mean barwidth=.5 name="C" ; endlayout; layout overlay / cycleattrs=true; barchart x=type y=mpg_highway / stat=mean barwidth=.8; barchart x=type y=mpg_city / stat=mean barwidth=.5; endlayout; sidebar / align=top; discretelegend "H" "C" / border=false; endsidebar;

74 Chapter 7 • LAYOUT LATTICE Statement

Page 85: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

rowaxes; rowaxis / display=(tickvalues) displaysecondary=(tickvalues) griddisplay=on; endrowaxes; endlayout; endgraph; end;run;proc sgrender data=sashelp.cars template=layoutlattice;run;

Statement SummaryThe LAYOUT LATTICE statement creates a grid of graphs that are aligned across columnsand rows. For plot statements that are specified in the layout block or nested in a LAYOUTOVERLAY statement, the LATTICE layout automatically aligns the plot areas and tickdisplay areas in the plots.

Note: To achieve the alignment, the LATTICE layout automatically aligns plot areas andtick display areas across columns and rows. Also, it overrides axis-offset settings onthe OVERLAY layouts that you specify in those columns and rows. (For details aboutoffsets and the tick display area, see “Adjusting Axis Offsets” on page 403.) If you donot want this alignment, you might use LAYOUT GRIDDED instead. For example, ifyou have a heterogeneous panel of graphs, such as a mix of scatter plots, box plots, barcharts, or other types of graphs, you might consider using LAYOUT GRIDDED ratherthan LAYOUT LATTICE.

The layout can unify the scale of the data ranges that are displayed in the plots, based onthe values set for the COLUMNDATARANGE and ROWDATARANGE= options. Thedata ranges can be scaled separately for each column, for each row, or for both. Or theycan be scaled across all columns, all rows, or all of both.

When the data-range scales are unified, you can simplify the layout by displaying only theexternal axes that apply to all of the graphs across the corresponding columns or rows. See“Axis Statements” on page 79 for more details.

The following figure shows the parts of the Lattice layout with the default axis display(internal axes are displayed).

Example Program and Statement Details 75

Page 86: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

This next figure shows the parts of the Lattice layout when the graph display is simplifiedso that only external axes are displayed.

76 Chapter 7 • LAYOUT LATTICE Statement

Page 87: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The columns and rows can be separated by areas called “gutters,” which are controlled bythe COLUMNGUTTER= and ROWGUTTER= options. In addition, theCOLUMNWEIGHTS= and ROWWEIGHTS= options can be used to allocate a proportionof available space to each row and column.

The LATTICE layout automatically decides how much area to allocate to cell contents:

• text items have a fixed size based on the amount of text and the font properties

• graphs take up the remaining space.

The layout’s grid size is determined by the COLUMNS= and ROWS= options.

By default, the results of the GTL-statements are placed into the grid sequentially from leftto right, wrapping to a new row each time the current row is filled. You can use theORDER= option to fill cells from top to bottom down a column. In that case, the layoutcells wrap to a new column each time the current column is filled.

Cell ContentsThe content of each cell in a LAYOUT LATTICE is specified by GTL-statement(s) thatcan be specified independently or enclosed in a CELL block. When you enclose thestatements in a CELL block, you can specify one or more header lines at the top of the cell.If you do not need a cell header in a cell, there is no need to use the CELL block.

The following general syntax is used for the contents of each cell in a LAYOUT LATTICE:

GTL-statement(s) | cell-statement-block(s)

A cell-statement-block, when used, has the following syntax:

Example Program and Statement Details 77

Page 88: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

CELL;<CELLHEADER; GTL-statement(s);ENDCELLHEADER;>GTL-statement(s);

ENDCELL;

• The contents of each cell is generated by GTL-statement(s) that can be specifiedindependently or enclosed in a CELL block.

• Whether specified independently or enclosed in a CELL block, the GTL-statement(s)can include text statements, plot statements, or layout statements.

• Within a CELL block, a CELLHEADER block can be used to generate one or moreheader lines within the cell. Each header line is specified on a separate GTL-statement within the CELLHEADER block. The header block is typically used tospecify one or more text statements, but other statements are allowed within the block.For example, you could specify a LAYOUT GRIDDED statement to produce a grid oftext for the header

• Only one CELLHEADER block can be used per CELL block. If more than one isspecified, only the last one is used.

• If a CELLHEADER block is not specified in a CELL block, the enclosed GTL-statement(s) produce the same results they would produce if they were specifiedindependently.

The following example shows a LAYOUT LATTICE block that uses one GTL-statementand one cell-statement-block to generate the two-column layout shown in the followingfigure:

begingraph; layout lattice / columngutter=5 columns=2; /* independent plot statement - defines first cell */ scatterplot x=age y=height;

/* cell block - defines second cell */ cell;

78 Chapter 7 • LAYOUT LATTICE Statement

Page 89: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

cellheader; entry "Cell Header" / border =true; endcellheader;

scatterplot x=weight y=height;

endcell; endlayout;endgraph;

Axis StatementsThe axis statements can be used to simplify and clarify the layout by displaying only theexternal axes in the resulting graph.

The following figure shows the default layout with internal axes displayed:

This next figure shows a simplified layout with only the external axes displayed:

Example Program and Statement Details 79

Page 90: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Axis statements are useful only if the data ranges across the affected columns or rows arecomparable and can be unified to a common scale. For example, external axes are notsupported if an affected lattice cell contains a LAYOUT OVERLAYEQUATED statement.

To unify column data ranges, use the COLUMNDATARANGE option. To unify row dataranges, use the ROWDATARANGE= option. If the axis ranges are not unified for theaffected columns or rows, the axis statements in the layout are ignored.

For columns, external X axes (top, bottom, or both) are specified within a COLUMNAXESblock, nesting one or more COLUMAXIS statements within the block. If a lattice cellcontains a LAYOUT OVERLAY with the XAXISOPTS= option specified, theXAXISOPTS= option is ignored. In such cases, the desired axis features should be specifiedin the COLUMNAXIS statement. An X2AXISOPTS= option is also ignored if specifiedon the OVERLAY.

For rows, external Y axes (left, right, or both) are specified within a ROWAXES block,nesting one or more ROWAXIS statements within the block. If a lattice cell contains aLAYOUT OVERLAY with the YAXISOPTS= option specified, the YAXISOPTS= optionis ignored. In such cases, the desired axis features should be specified in the ROWAXISstatement. A Y2AXISOPTS= option is also ignored if specified on the OVERLAY.

The axis statements have the following general syntax:

COLUMNAXES;COLUMNAXIS / axis-option(s);<…COLUMNAXIS-n;>

ENDCOLUMNAXES;

ROWAXES;ROWAXIS / axis-option(s);<…ROWAXIS-n;>

ENDROWAXES;

• Only one COLUMNAXES block can be used in the LATTICE layout block. If morethan one is specified, only the last one is used.

• Within a COLUMNAXES block, the number of COLUMNAXIS statements shouldmatch the number of columns.

• Only one ROWAXES block can be used in the LATTICE layout block. If more thanone is specified, only the last one is used.

• Within a ROWAXES block, the number of ROWAXIS statements should match thenumber of rows.

• If the number COLUMNLAXIS or ROWAXIS statements is greater than the numberneeded, the extra statements are ignored. If the number of statements is fewer than thenumber needed, the additional COLUMNAXIS or ROWAXIS statements areautomatically generated with DISPLAY=NONE options in effect.

For the list of axis-options, see “Axis Options for LAYOUT LATTICE” on page 437.

The following example shows a LAYOUT LATTICE block that uses a ROWAXES blockto set external axes and display gridlines for the row display.

begingraph; layout lattice / rowdatarange=union columns=2;

/* axis definitions */

80 Chapter 7 • LAYOUT LATTICE Statement

Page 91: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

rowaxes; rowaxis /griddisplay=on; endrowaxes;

/* cell contents */ scatterplot x=x y=t; scatterplot x=x y=y;

endlayout; endgraph;

Here, the LAYOUT LATTICE statement specifies the ROWDATARANGE option tounify the data ranges across rows in the layout. Because LAYOUT LATTICE specifiesCOLUMNS=2 and there are two plot statements in the template, the resulting graph hastwo columns and only one row. Thus, only one ROWAXIS statement is needed in theROWAXES block to specify axis attributes for that row of graphs.

Header StatementsHeader statements are used to display one or more headers for the columns and rows in aLattice layout. Each statement is specified as a block in the form statement -ENDstatement. The header block is typically used to specify one or more text statements,but other statements are allowed within the block. For example, you could specify aLAYOUT GRIDDED statement to produce a grid of text for the header.

The general syntax for a COLUMNHEADERS statement is

COLUMNHEADERS;GTL-statement(s);

ENDCOLUMNHEADERS;

The following header statements are available:

COLUMNHEADERS specifies a header for the primary (bottom)column-header position.

COLUMN2HEADERS specifies a header for the secondary (top)column-header position.

ROWHEADERS specifies a header for the primary (left) row-header position. ENTRY statements can beused to specify rotated text.

ROW2HEADERS specifies a header for the secondary (right) row-header position. ENTRY statements can beused to specify rotated text.

• The LAYOUT LATTICE aligns headers with the columns, or the rows, or both.

• Each of the header blocks COLUMNHEADERS, COLUMN2HEADERS,ROWHEADERS, and ROW2HEADERS can be used once in a LAYOUT LATTICEblock. If more than one block is specified for one of the statements, only the lastspecified block for that statement is used.

The following example shows a LAYOUT LATTICE block that uses aCOLUMNHEADERS block to display column headers above the left and right columnsin the layout.

Example Program and Statement Details 81

Page 92: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

begingraph; layout lattice / columns=2;

/* Lattice header definitions */ columnheaders; entry "Left Column"; entry "Right Column"; endcolumnheaders;

/* cell contents */ scatter x=x y=t; scatter x=x y=y;

endlayout; endgraph;

Sidebar StatementsA LAYOUT LATTICE supports the display of a sidebar between a row or column headerand an external axis. (See the figures in .)“Example Program and Statement Details” onpage 73 A sidebar spans across columns or rows and is useful for displaying informationthat applies to all of the columns or all of the rows. For example, sidebars are useful fordisplaying legends.

A SIDEBAR statement has the following syntax:

SIDEBAR </ ALIGN= BOTTOM | TOP | LEFT | RIGHT>;GTL-statement(s);

ENDSIDEBAR;

• ALIGN=BOTTOM is the default alignment.

• You can specify up to four SIDEBAR blocks in a LAYOUT LATTICE, one for eachof the top, bottom, left, and right sidebar positions.

• If two or more SIDEBAR blocks have the same alignment, the sidebar informationforms two or more columns (ALIGN=LEFT or ALIGN=RIGHT) within the sidebararea. Or it forms two or more rows (ALIGN=TOP or ALIGN=BOTTOM) within thesidebar area.

• Only one statement (such as ENTRY or DISCRETELEGEND) or one layout block(such as LAYOUT GRIDDED) is allowed in a SIDEBAR block. To create multi-linetext in a sidebar, nest ENTRY statements within a LAYOUT GRIDDED block.

• The LAYOUT LATTICE automatically aligns a sidebar with the layout columns orrows.

• Using ENTRY statements with the ROTATE= option, it is possible to place rotatedtext in the right or left sidebars.

The following example shows a LAYOUT LATTICE block that uses a SIDEBAR blockto display a top sidebar in the layout.

begingraph; layout lattice / columns=2; sidebar / align=top; layout gridded / border=true ; entry "Top Sidebar" ; entry "(spans both columns)";

82 Chapter 7 • LAYOUT LATTICE Statement

Page 93: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

endlayout; endsidebar; scatterplot x=x y=t; scatterolot x=x y=y; endlayout;begingraph;

Options

Statement Option Description

AUTOALIGN specifies whether this layout is automaticallyaligned within its parent when nested within anoverlay-type layout.

BACKGROUNDCOLOR Specifies the color of the layout background.

BORDER Specifies whether a border is drawn around thelayout.

BORDERATTRS Specifies the properties of the border line.

COLUMNDATARANGE Specifies how the X-axis data ranges of graphswithin the layout columns are scaled.

COLUMNGUTTER Specifies the amount of empty space betweenthe columns.

COLUMNS Specifies the number of columns in the layout.

COLUMNWEIGHTS Specifies the fractional proportion of each cellrelative to the overall grid width, not includingheaders, sidebars, and column axes.

HALIGN Specifies this layout’s horizontal alignmentwithin its parent when nested within an overlay-type layout.

OPAQUE Specifies whether the layout background isopaque.

ORDER Specifies whether cells are populated withcolumn priority or row priority.

PAD Specifies the amount of extra space that isadded inside the layout border.

ROWDATARANGE Specifies how the Y-axis data ranges of graphswithin the layout are scaled.

ROWGUTTER Specifies amount of empty space between therows.

Example Program and Statement Details 83

Page 94: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

ROWS Specifies the number of rows in the layout.

ROWWEIGHTS Specifies the fractional proportion of each cellrelative to the overall grid height, not includingheaders, sidebars, and row axes.

SKIPEMPTYCELLS Specifies whether the external axes skip theunused cells in a partially filled lattice.

VALIGN Specifies this layout’s vertical alignment withinits parent when nested within an overlay-typelayout.

AUTOALIGN= NONE | AUTO | (location-list)specifies whether this layout is automatically aligned within its parent when nestedwithin an overlay-type layout. For more information about how child positions aredetermined in an overlay-type layout, see the LAYOUT OVERLAY’s “ExampleProgram and Statement Details” on page 89.

Default: NONE

NONEDo not automatically align this layout within its parent layout. This layout’s positionwithin its parent layout is therefore set by the HALIGN= and VALIGN= options.

AUTOAvailable only if the parent layout contains a scatter plot; ignored otherwise. Withinthe parent layout, attempt to center this layout in the area that is farthest from anysurrounding data point markers.

(location-list)Within the parent layout, restrict this layout’s possible locations to those locationsin the specified location-list, and use the location-list position that least collideswith the parent layout’s other graphics features. The location-list is blank-separatedand can contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT,CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.

dynamic VAR STAT1 STAT2 STAT3; layout overlay; histogram VAR; layout lattice / AUTOALIGN=(TOPRIGHT TOPLEFT)columns=1; entry STAT1; entry STAT2; entry STAT3; endlayout;endlayout;

Here the LATTICE layout is the child of the OVERLAY layout. The child layoutappears in either the top right or top left position, based on which position has more“unoccupied” area.

Restriction: This option is available only when this layout statement is nested withinan overlay-type layout. This option is ignored if this statement is the outermost layoutor if the parent layout is not an overlay-type layout.

84 Chapter 7 • LAYOUT LATTICE Statement

Page 95: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: If this option is enabled, it overrides the HALIGN= and VALIGN=options.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the layout background.

Default: The GraphBackground:Color style reference.

style-elementA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is drawn around the layout.

Default: FALSE

Interaction: If this option is set to FALSE, the BORDERATTRS option is ignored.

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the layout. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

COLUMNDATARANGE= DATA | UNION | UNIONALLspecifies how the X-axis data ranges of graphs within the layout columns are scaled.

Default: DATA

DATAscales the X-axis data ranges separately for each cell in the layout.

UNIONscales the X-axis data ranges separately for each column in the layout. This settingis supported only if all plots across the column can share the same data range andaxis type. For more information, see “Plot Axis Types Must Agree on CommonAxes” on page 400.

UNIONALLscales the X-axis data ranges across all columns in the layout. This setting issupported only if all plots across the column can share the same data range and axistype. For more information, see “Plot Axis Types Must Agree on Common Axes”on page 400.

Restriction: If any plot statement in any cell contains an XAXIS=X2 option, this optionis ignored if it is set to UNION or UNIONALL. The union setting causes all data to bemapped to the X axis.

Interaction: Axes are always internal to the cell, by default. To externalize columnaxes, 1) set this option to UNION or UNIONALL 2) specify a COLUMNAXES blockwith as many COLUMNAXIS statements as there are columns.

If column axes are externalized, and if a lattice cell contains a LAYOUT OVERLAYwith the XAXISOPTS= option specified, the XAXISOPTS option is ignored. In suchcases, the COLUMNAXIS statement should be used to specify desired axis features.

COLUMNGUTTER=dimensionspecifies the amount of empty space between the columns.

Example Program and Statement Details 85

Page 96: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: 0

If there are n columns, then there are n-1 gutters.

COLUMNS=integerspecifies the number of columns in the layout.

Default: If ORDER=ROWMAJOR, the default is 1. If ORDER=COLUMNMAJOR,as many columns are created as are needed to satisfy the ROWS= request.

Interaction: If both ROWS=n and COLUMNS=m is specified, an n by m grid of cellsis created. If the number of statements that define cell contents is greater than n x m,the grid size does not expand and some statements are not displayed. If the number ofstatements that define cell contents is less than n x m, the grid will contain empty cells.

If this option is not defined and ORDER=COLUMNMAJOR, the number of columnsis dynamically determined by the number of defined cells.

COLUMNWEIGHTS= (numeric-list)specifies the fractional proportion of each cell relative to the overall grid width, notincluding headers, sidebars, and column axes.

Requirement: numeric-list must be enclosed in parentheses. If there are n columns,then the list specified should contain n values and the sum of the weights should be 1.0.

HALIGN= CENTER | LEFT | RIGHTspecifies this layout’s horizontal alignment within its parent when nested within anoverlay-type layout. For more information about how child positions are determinedin an overlay-type layout, see the LAYOUT OVERLAY’s “Example Program andStatement Details” on page 89.

Default: CENTER

Restriction: This option is available only when this statement is nested within anoverlay-type layout. It is ignored if this statement is the outermost layout or if the parentlayout is not an overlay-type layout.

Interaction: If the AUTOALIGN= option is enabled, this option is ignored.

Discussion: In the following example, the LATTICE layout is the child of theOVERLAY layout and is positioned in the OVERLAY’s top right corner.

dynamic VAR STAT1 STAT2 STAT3; layout overlay; histogram VAR; layout lattice / VALIGN=TOP HALIGN=RIGHTcolumns=1; entry STAT1; entry STAT2; entry STAT3; endlayout;endlayout;

OPAQUE= booleanspecifies whether the layout background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

ORDER= ROWMAJOR | COLUMNMAJORspecifies whether cells are populated with column priority or by row priority.

Default: ROWMAJOR

86 Chapter 7 • LAYOUT LATTICE Statement

Page 97: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ROWMAJORfills all the columns in a row, from left to right, before going to the next row.

COLUMNMAJORfills all the rows in a column, from top to bottom, before going to the next column.

Requirement: If this option is set to COLUMNMAJOR, the ROWS= option must bespecified to indicate how many rows to fill before wrapping to the next column. Thedefault number of rows is 1.

Requirement: If this option is set to ROWMAJOR, the COLUMNS= option must bespecified to indicate how many columns to fill before wrapping to the next column.The default number of columns is 1.

PAD=dimension | (pad-options)specifies the amount of extra space that is added inside the layout border.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the layout border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

ROWDATARANGE= DATA | UNION | UNIONALLspecifies how the Y-axis data ranges of graphs within the layout rows are scaled.

Default: DATA

DATAscales the Y-axis data ranges separately for each cell in the layout.

UNIONscales the Y-axis data ranges separately for each row in the layout. This setting issupported only if all plots down the row can share the same data range and axistype. For more information, see “Plot Axis Types Must Agree on Common Axes”on page 400.

UNIONALLscales the Y-axis data ranges across all rows in the layout. This setting is supportedonly if all plots down the row can share the same data range and axis type. For moreinformation, see “Plot Axis Types Must Agree on Common Axes” on page 400.

Example Program and Statement Details 87

Page 98: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: If any plot statement in any cell contains a YAXIS=Y2 option, this optionis ignored whenever it is set to UNION or UNIONALL. The union setting causes alldata to be mapped to the Y axis.

Interaction: Axes are always internal to the cell, by default. To externalize row axes,1) set this option to UNION or UNIONALL 2) specify a ROWAXES block with asmany ROWAXIS statements as there are rows.

If row axes are externalized, and if a lattice cell contains a LAYOUT OVERLAY withthe YAXISOPTS= option specified, the YAXISOPTS option is ignored. In such cases,the ROWAXIS statement should be used to specify desired axis features.

ROWGUTTER=dimensionspecifies amount of empty space between the rows.

Default: 0

If there are n rows, then there are n-1 gutters.

ROWS=integerspecifies the number of rows in the layout.

Default: If ORDER=COLUMNMAJOR, the default is 1. If ORDER=ROWMAJOR,as many ROWS are created as needed to satisfy the COLUMNS= request.

Interaction: If both ROWS=n and COLUMNS=m is specified, an n by m grid of cellsis created. If the number of statements that define cell contents is greater than n x m,the grid size does not expand and some statements are not displayed. If the number ofstatements that define cell contents is less than n x m, the grid will contain empty cells.

ROWWEIGHTS=(numeric-list)specifies the fractional proportion of each cell relative to the overall grid height, notincluding headers, sidebars, and row axes.

Requirement: numeric-list must be enclosed in parentheses. If there are n columns,then the list specified should contain n values and the sum of the weights should be 1.0.

SKIPEMPTYCELLS=booleanspecifies whether the external axes skip the unused cells in a partially filled lattice.

Default: FALSE

FALSEExternal axes are displayed at their normal locations.

TRUEEmpty cells are skipped by external axes and the axes “snap” to the nearestpopulated cell, both vertically and horizontally.

VALIGN=CENTER | TOP | BOTTOMspecifies this layout’s vertical alignment within its parent when nested within anoverlay-type layout. For more information about how child positions are determinedin an overlay-type layout, see the LAYOUT OVERLAY’s “Example Program andStatement Details” on page 89.

Default: CENTER

Restriction: This option is available only when this statement is nested within anoverlay-type layout. It is ignored if this statement is the outermost layout or if the parentlayout is not an overlay-type layout.

Interaction: If the AUTOALIGN= option is enabled, this option is ignored.

88 Chapter 7 • LAYOUT LATTICE Statement

Page 99: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 8

LAYOUT OVERLAY Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

Description and SyntaxBuilds a composite from one or more GTL-statements. The composite could be an entiregraph. Or, if this layout is nested in a GRIDDED or LATTICE layout, the compositetypically provides contents for one cell in the parent layout.

LAYOUT OVERLAY </option(s)>;GTL-statements;

ENDLAYOUT;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 90:

89

Page 100: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph layoutoverlay; begingraph; entrytitle "Trends in Employment Levels"; layout overlay / cycleattrs=true xaxisopts=(display=(ticks tickvalues)) yaxisopts=(label="Number of Workers (thousands)"); seriesplot x=date y=electric / curvelabel="Electrical" curvelabellocation=outside; seriesplot x=date y=masonry / curvelabel="Masonry" curvelabellocation=outside; endlayout; endgraph; end;run;proc sgrender data=sashelp.workers template=layoutoverlay;run;

Statement SummaryThe LAYOUT OVERLAY statement builds a composite using one or more GTL-statements. You can specify one or more 2-D plots within the layout, provided all plots canshare the same type of axes. You can also specify one or more insets, such as nested layoutstatements (for example, LAYOUT GRIDDED), ENTRY statements, and legendstatements (CONTINUOUSLEGEND or DISCRETELEGEND).

The following general logic applies to rendering the composite:

90 Chapter 8 • LAYOUT OVERLAY Statement

Page 101: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• All plot statements are rendered first. Plot statement results are always rendered in theplot area. The plots are stacked on top of one another in the order in which they arespecified, with the last one on top. It is possible for one plot’s graphical data to obscuregraphical data beneath it. You can control this by selectively ordering the plotstatements, or by using transparency on the individual plots, or by doing both.

• The insets are rendered next, in the order in which they are specified. As with the plotstatements, it is possible for the insets to obscure the results of other statements in thelayout.

• To control the horizontal and vertical positioning of an inset, use the inset statement’sAUTOALIGN= option, or its HALIGN= and VALIGN= options. Each nested insetdetermines its own relative position in the parent OVERLAY.

• Some insets, like legends, can be positioned inside or outside of the plot area using theinset statement’s LOCATION= option. The inset’s AUTOALIGN= or HALIGN= andVALIGN= settings are then relative to that location.

Generally, the first specified plot determines the layout’s default axis characteristics. Toenable another plot to define the axis characteristics, set PRIMARY=TRUE for that plot.For more information about the default axis characteristics, see “When Plots Share Dataand a Common Axis” on page 397.

See Also: LAYOUT OVERLAYEQUATED and LAYOUT OVERLAY3D.

Options

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the layout background.

BORDER Specifies whether a border is drawn around thelayout.

BORDERATTRS Specifies the properties of the border line.

CYCLEATTRS Specifies whether the default visual attributesof markers, lines, and fills in nested plotstatements automatically change from plot toplot.

OPAQUE Specifies whether the layout background isopaque.

PAD Specifies the amount of extra space that isadded inside the layout border.

Example Program and Statement Details 91

Page 102: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

WALLCOLOR Specifies the fill color of the plot wall area.

WALLDISPLAY Specifies whether the plot’s wall and walloutline are displayed.

XAXISOPTS Specifies one or more X axis options.

X2AXISOPTS Specifies one or more X2 axis options.

YAXISOPTS Specifies one or more Y axis options.

Y2AXISOPTS Specifies one or more Y2 axis options.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the layout background.

Default: The GraphBackground:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is drawn around the layout.

Default: FALSE

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the layout. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

CYCLEATTRS=booleanspecifies whether the default visual attributes of markers, lines, and fills in nested plotstatements automatically change from plot to plot. See “Cycling Through GroupAttributes in Overlaid Plots” on page 121 for more information.

Default: FALSE

FALSEdoes not cycle the default visual attributes of multiple plots. For example, if youoverlay three series plots, each series line has the same default visual properties.

TRUEthe system looks at the plots in the layout and tries to use the GraphData1 -GraphDataN style elements to assign different visual properties to applicable plots(scatter plots and series plots and others). For example, if you overlay three seriesplots, the three series lines receive different default visual properties (line patternand color). These default properties are determined by the next GraphDataN styleelement not already used. Some plots in the layout do not participate in the cycling(for example, reference lines and drop lines).

92 Chapter 8 • LAYOUT OVERLAY Statement

Page 103: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OPAQUE= booleanspecifies whether the layout background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

PAD=dimension | (pad-options)specifies the amount of extra space that is added inside the layout border.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the layout border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

WALLCOLOR=style-reference | colorspecifies the fill color of the plot wall area.

Default: The GraphWalls:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style- attributenamed COLOR is used.

Interaction: This option is ignored if WALLDISPLAY=NONE orWALLDISPLAY=(OUTLINE).

WALLDISPLAY=STANDARD | ALL | NONE | (display-options)specifies whether the plot’s wall and wall outline are displayed.

Default: STANDARD

STANDARDDisplays a filled wall. The setting of the FRAMEBORDER= ON | OFF attributeof the GraphWalls style element determines whether the wall outline is displayed.

ALLDisplays a filled, outlined wall.

NONEDisplays no wall, no wall outline.

(display-options)These options must be enclosed in parentheses and include one of the following:

Example Program and Statement Details 93

Page 104: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OUTLINE displays the wall outline.FILL displays a filled wall area.

Use the WALLCOLOR= option to control the fill color of the wall.

The appearance attributes of the wall outline are set by the GraphAxisLine styleelement.

XAXISOPTS= ( axis-options )specifies one or more X axis options. For a list of options, see “Axis Options forLAYOUT OVERLAY” on page 405.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

X2AXISOPTS= ( axis-options )specifies one or more X2 axis options. For a list of options, see “Axis Options forLAYOUT OVERLAY” on page 405.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

YAXISOPTS= ( axis-options )specifies one or more Y axis options. For a list of options, see “Axis Options forLAYOUT OVERLAY” on page 405.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

Y2AXISOPTS= ( axis-options )specifies one or more Y2 axis options. For a list of options, see “Axis Options forLAYOUT OVERLAY” on page 405.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

94 Chapter 8 • LAYOUT OVERLAY Statement

Page 105: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 9

LAYOUT OVERLAYEQUATEDStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

Description and SyntaxBuilds a composite from one or more GTL-statements. The composite could be an entiregraph. Or, if this layout is nested in another layout, such as a GRIDDED layout, thecomposite typically provides contents for one cell in the parent layout. In anOVERLAYEQUATED layout, the display unit of the X axis always equals the display unitof the Y axis.

LAYOUT OVERLAYEQUATED </option(s)>;GTL-statements;

ENDLAYOUT;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 96:

95

Page 106: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph layoutoverlayequated; begingraph; entrytitle "Gas Mileage for GMC Models"; layout overlayequated / equatetype=fit; referenceline y=16.2 / curvelabel="City Average for Trucks/SUVs" curvelabellocation=inside curvelabelattrs=GraphReference; referenceline x=20.6 / curvelabel="Highway Average for Trucks/SUVs" curvelabellocation=inside curvelabelattrs=GraphReference; scatterplot x=mpg_highway y=mpg_city / datalabel=model; endlayout; endgraph; end;run;proc sgrender data=sashelp.cars template=layoutoverlayequated; where make="GMC";run;

Statement SummaryThe LAYOUT OVERLAYEQUATED statement is similar to the LAYOUT OVERLAYstatement: it builds a composite using one or more GTL-statements. Similar to a LAYOUTOVERLAY, you can specify one or more 2-D plots within the layout, provided all plots

96 Chapter 9 • LAYOUT OVERLAYEQUATED Statement

Page 107: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

can share the same type of axes. (Additional restrictions are discussed in a moment.) Youcan also specify one or more insets.

As an overlay-type layout, OVERLAYEQUATED has the same behavioral characteristicsas an OVERLAY layout. It uses the same general logic for rendering the composite (see“LAYOUT OVERLAY Statement” on page 89 for details), and its default axischaracteristics are generally determined by the first specified plot, unless you usePRIMARY=TRUE on an alternative plot statement (see “When Plots Share Data and aCommon Axis” on page 397).

OVERLAYEQUATED differs from OVERLAY in several ways. WithOVERLAYEQUATED,

• The axis type for both X and Y axes is always linear. Thus, plot types that have discreteor binned axes cannot be used within this layout (for example, BOXPLOT,BOXPLOTPARM, BARCHARTPARM, HISTOGRAM, andHISTOGRAMPARM).

• For equal data intervals on both axes, the display distance is the same. For example, aninterval of 2 on the X axis maps to the same display distance as an interval of 2 on theY axis.

• The aspect ratio of the plot display equals the aspect ratio of the plot data. In otherwords, a 45 degree slope in data is represented by a 45 degree slope in the display. TheEQUATETYPE= option determines how the axes are drawn.

The following figure illustrates how a series plot might map differently when specified inan OVERLAYEQUATED layout versus an OVERLAY layout:

A LAYOUT OVERLAYEQUATED statement enables you to specify one or more of thefollowing XY plots: SCATTERPLOT, SERIESPLOT, NEEDLEPLOT, STEPPLOT,VECTORPLOT, BANDPLOT, LOESSPLOT, REGRESSIONPLOT, PBSPLINEPLOT,and CONTOURPLOTPARM. As long as one of these plots is present, you can also addFRINGEPLOT, LINEPARM, MODELBAND, REFERENCELINE, DROPLINE, andinsets as ENTRY, DISCRETELEGEND, and CONTINUOUSLEGEND.

From a data standpoint, this layout has only two independent axes, X and Y. If any plotswithin the layout block use an XAXIS=X2 or YAXIS=Y2 option, the option is ignored andthe data are mapped to the X or Y axis. To display X2 and Y2 axes, use theDISPLAYSECONDARY= suboption of the XAXISOPTS= and YAXISOPTS= options.

If an OVERLAYEQUATED statement is nested in a LATTICE layout, some of theLATTICE’s alignment and external axis features are not supported on theOVERLAYEQUATED layout.

Example Program and Statement Details 97

Page 108: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Options

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the layout background.

BORDER Displays the border around the layout.

BORDERATTRS Specifies the properties of the border line.

COMMONAXISOPTS Specifies one or more axis options to be appliedto all displayed axes.

CYCLEATTRS Specifies whether the default visual attributesof markers, lines, and fills in nested plotstatements automatically change from plot toplot.

EQUATETYPE Specifies how to draw the axis area.

OPAQUE Specifies whether the layout background isopaque.

PAD Specifies the amount of extra space that isadded inside the layout border.

WALLCOLOR Specifies the fill color of the plot wall area.

WALLDISPLAY Specifies whether the plot’s wall and walloutline are displayed.

XAXISOPTS Specifies one or more X axis options.

YAXISOPTS Specifies one or more Y axis options.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the layout background.

Default: The GraphBackground:Color style reference.

style-elementA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is drawn around the layout.

Default: FALSE

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the layout. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

98 Chapter 9 • LAYOUT OVERLAYEQUATED Statement

Page 109: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

COMMONAXISOPTS= (common-equated-axis-options)specifies one or more axis options to be applied to all displayed axes. For a list ofoptions, see “Options That Apply in Common to Both Equated Axes” on page 456

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

CYCLEATTRS=booleanspecifies whether the default visual attributes of markers, lines, and fills in nested plotstatements automatically change from plot to plot. See “Cycling Through GroupAttributes in Overlaid Plots” on page 121 for more information.

Default: FALSE

FALSEdoes not cycle the default visual attributes of multiple plots. For example, if youoverlay three series plots, each series line has the same default visual properties.

TRUEthe system looks at the plots in the layout. It tries to use the GraphData1 -GraphDataN style elements to assign different visual properties to applicable plots(scatter plots and series plots and others). For example, if you overlay three seriesplots, the three series lines receive different default visual properties (line patternand color). These default properties are determined by the next GraphDataN styleelement not already used. Some plots in the layout do not participate in the cycling(for example, reference lines and drop lines).

EQUATETYPE= FIT | SQUARE | EQUATEspecifies how to draw the axis area.

Default: FIT

FITX and Y axes have equal increments between tick values. The data ranges of bothaxes are compared to establish a common increment size. The axes might be ofdifferent lengths and have a different number of tick marks. Each axis representsits own data range. One axis might be extended to use available space in the plotarea. If a TICKVALUELIST= or TICKVALUESEQUENCE= axis option is usedon COMMONAXISOPTS=, it is ignored.

SQUAREBoth the X and Y axes have the same length and the same major tick values. Theaxis length and tick values are chosen so that the minimum and maximum of bothX and Y appear in the range of values appearing on both axes.

EQUATESame as FIT except that neither axis is extended to use available space in the plotarea.

Example Program and Statement Details 99

Page 110: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OPAQUE= booleanspecifies whether the layout background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

PAD=dimension | (pad-options)specifies the amount of extra space that is added inside the layout border.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the layout border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

WALLCOLOR=style-reference | colorspecifies the fill color of the plot wall area.

Default: The GraphWalls:Color style reference.

style-elementA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: This option is ignored if WALLDISPLAY=NONE orWALLDISPLAY=(OUTLINE).

WALLDISPLAY= STANDARD | ALL | NONE | (display-options)specifies whether the plot’s wall and wall outline are displayed.

Default: STANDARD

STANDARDDisplays a filled wall. The setting of the FRAMEBORDER= ON | OFF attributeof the GraphWalls style element determines whether the wall outline is displayed.

ALLDisplays a filled, outlined wall.

NONEDisplays no wall, no wall outline.

(display-options)A list of options, enclosed in parentheses, that must include one of the following:

100 Chapter 9 • LAYOUT OVERLAYEQUATED Statement

Page 111: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OUTLINE displays the wall outline.FILL displays the plot wall.

Use the WALLCOLOR= option to control the fill color of the wall.

The appearance attributes of the wall outline are set by the GraphAxisLine styleelement.

XAXISOPTS= ( equated-axis-options )specifies one or more X axis options. For a list of options, see “Options That ApplySeparately to an X or Y Equated Axis” on page 459

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

YAXISOPTS= ( equated-axis-options )specifies one or more Y axis options. For a list of options, see “Options That ApplySeparately to an X or Y Equated Axis” on page 459

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

Example Program and Statement Details 101

Page 112: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

102 Chapter 9 • LAYOUT OVERLAYEQUATED Statement

Page 113: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 10

LAYOUT OVERLAY3DStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

Description and SyntaxBuilds a 3-D composite from one or more GTL-statements. The composite could be anentire graph. Or, if this layout is nested in a GRIDDED or LATTICE layout, the compositetypically provides contents for one cell in the parent layout.

LAYOUT OVERLAY3D </option(s)>;GTL-statements;

ENDLAYOUT;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 104:

103

Page 114: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph layoutoverlay3d; begingraph; entrytitle "Density Plot of Height and Weight"; layout overlay3d / tilt=10 rotate=54 walldisplay=none cube=false; surfaceplotparm x=height y=weight z=density / surfacecolorgradient=density; endlayout; endgraph; end;run;proc sgrender data=sashelp.gridded template=layoutoverlay3d;run;

Statement SummaryThe LAYOUT OVERLAY3D statement builds a 3-D composite using one or more GTL-statements. You can specify one or more 3-D plots within the layout, provided all plots canshare the same type of axes. You can also specify “annotations” (for example, with one ormore ENTRY statements or LAYOUT GRIDDED statements). However, annotations inthe OVERLAY3D layout are more likely to collide with other graphics features than areannotations in other overlay-type layouts.

As an overlay-type layout, OVERLAY3D has the same behavioral characteristics as anOVERLAY layout. It uses the same general logic for rendering the composite (see“LAYOUT OVERLAY Statement” on page 89 for details), and its default axischaracteristics are generally determined by the first specified plot, unless you use

104 Chapter 10 • LAYOUT OVERLAY3D Statement

Page 115: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PRIMARY=TRUE on another plot statement (see “When Plots Share Data and a CommonAxis” on page 397).

Within an OVERLAY3D layout, a graph’s bounding cube can be tilted, rotated, andzoomed to provide a different viewpoint. By default, the outline of the bounding cube isdisplayed and the viewing rotation angle is 57 degrees, the tilt angle is 20 degrees, and thezoom factor is 1. See the CUBE=, ROTATE=, TILT=, and ZOOM= options for informationabout how to change the viewpoint.

Options

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the layout background.

BORDER Specifies whether a border is drawn around thelayout.

BORDERATTRS Specifies the properties of the border line.

CUBE Specifies whether the layout displays the linesthat indicate the complete bounding cube of theaxis planes.

CYCLEATTRS Specifies whether the default visual attributesof lines and fills in nested plot statementsautomatically change from plot to plot.

OPAQUE Specifies whether the layout background isopaque.

PAD Specifies the amount of extra space that isadded inside the layout border.

ROTATE Specifies the angle of rotation in degrees.

TILT Specifies the angle of tilt in degrees.

WALLCOLOR Specifies the fill color of the plot’s walls.

WALLDISPLAY Specifies whether the plot’s walls and walloutlines are displayed.

XAXISOPTS Specifies one or more X axis options.

YAXISOPTS Specifies one or more Y axis options.

ZAXISOPTS Specifies one or more Z axis options.

ZOOM Specifies a zoom factor.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the layout background.

Default: The GraphBackground:Color style reference.

Example Program and Statement Details 105

Page 116: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

style-elementA reference in the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is drawn around the layout.

Default: FALSE

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the layout. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

CUBE=booleanspecifies whether the layout displays the lines that indicate the complete bounding cubeof the axis planes.

Default: TRUE

The color, thickness, and pattern of the cube lines are determined by theGraphAxisLines style element.

The cube lines are displayed independently of the wall borders and axis lines. Becausesome cube lines coincide with wall borders and axis lines, it might appear that turningoff wall borders or axis lines has no effect when CUBE=TRUE.

CYCLEATTRS=booleanspecifies whether the visual attributes of lines and fills in nested plot statementsautomatically change from plot to plot. See “Cycling Through Group Attributes inOverlaid Plots” on page 121 for more information.

Default: FALSE

FALSEdoes not cycle the default visual attributes of multiple plots. For example, if youoverlay two surface plots, each surface has the same visual properties.

TRUEthe system looks at the plots in the layout and tries to use the GraphData1 -GraphDataN style elements to assign different visual properties to the plots. Forexample, if you overlay two surface plots, the two surfaces receive different visualproperties. These default properties are determined by the next GraphDataN styleelement not already used.

OPAQUE= booleanspecifies whether the layout background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

PAD=dimension | (pad-options)specifies the amount of extra space that is added inside the layout border.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

106 Chapter 10 • LAYOUT OVERLAY3D Statement

Page 117: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the layout border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

ROTATE=numberSpecifies the angle of rotation. Rotation is measured in a clockwise direction about avirtual axis parallel to the Z axis (vertical) and passing through the center of thebounding cube. A counterclockwise rotation can be specified with a negative value.

Default: 54

TILT=numberSpecifies the angle of tilt in degrees. Tilt is measured in a clockwise direction about avirtual axis parallel to the X axis (vertical) and passing through the center of thebounding cube. A counterclockwise rotation can be specified with a negative value.

Default: 20

WALLCOLOR=style-reference | colorspecifies the fill color of the plot’s walls.

Default: The GraphWalls:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style- attributenamed COLOR is used.

Interaction: This option is ignored if WALLDISPLAY=NONE orWALLDISPLAY=(OUTLINE).

WALLDISPLAY= STANDARD | ALL | NONE | (display-options)specifies whether the plot’s walls and wall outlines are displayed.

Default: STANDARD

STANDARDDisplays an outlined wall. The setting of the FRAMEBORDER= ON | OFF attributeof the GraphWalls style element determines whether the wall outline is displayed.

ALLDisplays a filled, outlined wall.

NONEDisplays no wall fill, no wall outline.

Example Program and Statement Details 107

Page 118: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

(display-options)A list of options, enclosed in parentheses, that must include one of the following:

OUTLINE displays the wall outline.FILL displays the plot wall.

Use the WALLCOLOR= option to control the color of the wall.

Also see the CUBE= option.

XAXISOPTS= ( axis-options )specifies one or more X axis options. For a list of options, see “Axis Options forLAYOUT OVERLAY3D” on page 425.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

YAXISOPTS= ( axis-options )specifies one or more Y axis options. For a list of options, see “Axis Options forLAYOUT OVERLAY3D” on page 425.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

ZAXISOPTS= ( axis-options )specifies one or more Z axis options. For a list of options, see “Axis Options forLAYOUT OVERLAY3D” on page 425.

Requirement: Axis options must be enclosed in parentheses and separated by spaces.

ZOOM= positive-numberspecifies a zoom factor. Factors greater than 1 move closer to the bounding cube, lessthan 1 move farther away

Default: 1

108 Chapter 10 • LAYOUT OVERLAY3D Statement

Page 119: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 11

LAYOUT PROTOTYPEStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109LAYOUT PROTOTYPE is a Nested Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 109Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

Description and SyntaxBuilds a composite from one or more plot-statements. The composite is used as a prototypeor "rubber stamp" that repeats in each cell of a parent DATALATTICE or DATAPANELlayout.

LAYOUT PROTOTYPE </option(s)>plot-statements;

ENDLAYOUT;

Statement Details

LAYOUT PROTOTYPE is a Nested StatementThe LAYOUT PROTOTYPE statement is not an independent layout; it must be nested ina LAYOUT DATAPANEL or LAYOUT DATALATTICE block. Only plot statementscan be used within the LAYOUT PROTOTYPE block – no nested layouts. Additionalrestrictions are listed below.

The plot-statements determine the graphical content of the cells in the parent layout, basedon the subsetting of the specified classification variables. For an example, see “LAYOUTDATALATTICE Statement” on page 33 or “LAYOUT DATAPANEL Statement” on page49.

A PROTOTYPE layout is essentially a restricted OVERLAY layout with the same generalrules for overlaying plots. The main difference is that there are no axis options availableon the LAYOUT PROTOTYPE statement. Axis properties are set with theROWAXISOPTS= and COLUMNAXISOPTS= options of the parent DATAPANEL orDATALATTICE statement.

The following restrictions also apply to a LAYOUT PROTOTYPE block:

109

Page 120: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• Only non-computed 2-D plots can be included in the LAYOUT PROTOTYPE block.Thus, plots like BOXPLOT, HISTOGRAM, DENSITYPLOT, ELLIPSE,LOESSPLOT, MODELBAND, and REGRESSIONPLOT cannot be used. In addition,the prototype cannot contain a SCATTERPLOTMATRIX or 3-D plot.

• A plot statement cannot be used if it contains a column defined with an EVALexpression.

• You can add one or more 2-D plots to the graph area that the LAYOUT PROTOTYPEstatement creates, provided all of the graphs can share the same axis type.

• ENTRY, DISCRETELEGEND, and CONTINUOUSLEGEND statements cannot beused in the prototype layout.

• If you include a plot statement with a CURVELABEL= option (such as SERIESPLOT),only CURVELABELLOCATION=INSIDE is supported.

• If you include a plot statement that supports a CLIP= option (such as LINEPARM orELLIPSEPARM), the CLIP value is always set to TRUE.

• If any plot statement in the plot-statements contains a YAXIS=Y2 or XAXIS=X2option, this option is ignored and all data are mapped to the X and Y axes.

Options

Statement Option Description

CYCLEATTRS Specifies whether the default visual attributesof markers, lines, and fills in nested plotstatements automatically change from plot toplot.

WALLCOLOR Specifies the fill color of the plot wall area.

WALLDISPLAY Specifies whether the plot’s wall and walloutline are displayed.

CYCLEATTRS=booleanspecifies whether the default visual attributes of markers, lines, and fills in nested plotstatements automatically change from plot to plot. See “Cycling Through GroupAttributes in Overlaid Plots” on page 121 for more information.

Default: FALSE

FALSEdoes not cycle the default visual attributes of multiple plots. For example, if youoverlay three series plots, each series line has the same default visual properties.

TRUEthe system looks at the plots in the layout. It tries to use the GraphData1 -GraphDataN style elements to assign different visual properties to applicable plots(scatter plots and series plots and others). For example, if you overlay three seriesplots, the three series lines receive different default visual properties (line patternand color). These default properties are determined by the next GraphDataN styleelement not already used. Some plots in the layout do not participate in the cycling(for example, reference lines and drop lines).

WALLCOLOR=style-reference | colorspecifies the fill color of the plot wall area.

110 Chapter 11 • LAYOUT PROTOTYPE Statement

Page 121: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: The GraphWalls:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style- attributenamed COLOR is used.

Interaction: This option is ignored if WALLDISPLAY=NONE orWALLDISPLAY=(OUTLINE).

WALLDISPLAY=STANDARD | ALL | NONE | (display-options)specifies whether the plot wall and wall outline are displayed.

Default: STANDARD

STANDARDDisplays a filled wall. The setting of the FRAMEBORDER= ON | OFF attributeof the GraphWalls style element determines whether the wall outline is displayed.

ALLDisplays a filled, outlined wall.

NONEDisplays no wall, no wall outline.

(display-options)These options must be enclosed in parentheses and include one of the following:

OUTLINE displays the wall outline.FILL displays a filled wall area.

Use the WALLCOLOR= option to control the color of the wall.

The appearance attributes of the wall outline are set by the GraphAxisLine styleelement.

Statement Details 111

Page 122: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

112 Chapter 11 • LAYOUT PROTOTYPE Statement

Page 123: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 4

Plot Statements

Chapter 12Key Concepts for Using Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Chapter 13BANDPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Chapter 14BARCHART Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Chapter 15BARCHARTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

Chapter 16BIHISTOGRAM3DPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

Chapter 17BLOCKPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

Chapter 18BOXPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

Chapter 19BOXPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

Chapter 20CONTOURPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

Chapter 21DENSITYPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

Chapter 22DROPLINE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

Chapter 23ELLIPSE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

Chapter 24ELLIPSEPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

Chapter 25

113

Page 124: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

FRINGEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

Chapter 26HISTOGRAM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

Chapter 27HISTOGRAMPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

Chapter 28LINEPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

Chapter 29LOESSPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

Chapter 30MODELBAND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

Chapter 31NEEDLEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Chapter 32PBSPLINEPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

Chapter 33REFERENCELINE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

Chapter 34REGRESSIONPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

Chapter 35SCATTERPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

Chapter 36SCATTERPLOTMATRIX Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

Chapter 37SERIESPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351

Chapter 38STEPPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

Chapter 39SURFACEPLOTPARM Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375

Chapter 40VECTORPLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383

114

Page 125: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 12

Key Concepts for Using Plots

Minimum Requirements to Generate a Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

ODS Graphics Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Display Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117Display Attributes for Non-Grouped Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117Display Attributes for Grouped Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119Cycling Through Group Attributes in Overlaid Plots . . . . . . . . . . . . . . . . . . . . . . . 121Remapping Groups for Grouped Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121Interactions Between Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

Location and Position of Curve Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123Curve Label Location Relative to the Plot Area . . . . . . . . . . . . . . . . . . . . . . . . . . . 123Curve Label Position Relative to the Curve Line . . . . . . . . . . . . . . . . . . . . . . . . . . 124

Minimum Requirements to Generate a PlotODS graphics are generated by template definitions that determine a graph’s layout andappearance and specify the variable roles to be represented in the graph display. A graphcan be rendered from a compiled template by associating the template with a data sourceat run time.

The following SAS program shows the basic structure needed to meet the minimumrequirements for generating a plot using GTL:

proc template; define statgraph minimumreq; begingraph; layout overlay; scatterplot x=weight y=height; endlayout; endgraph; end;run;

proc sgrender data=sashelp.class template=minimumreq;run;

115

Page 126: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• The DEFINE STATGRAPH statement on PROC TEMPLATE is required to open adefinition block for defining and naming a graphics template. The END statementcloses the template definition.

• A BEGINGRAPH statement block is required to define the outermost container for thegraph. The ENDGRAPH statement closes the block.

• At least one layout statement block is required for specifying the elements that composethe graph. To generate a plot, the layout block must contain at least one plot statement.The ENDLAYOUT statement closes the layout block.

• The PROC TEMPLATE statement must be run to compile the template and save it inthe template store (SASUSER.TEMPLAT by default).

• The PROC SGRENDER statement is required to produce a graph from a compiledtemplate. The DATA= option specifies a run-time data source to use, and theTEMPLATE= option specifies the template to use. The input data source must satisfyany restrictions that are imposed by the template. For example, it must contain anyvariables that have been specified on the template’s GTL statements.

ODS Graphics EnvironmentThe ODS GRAPHICS statement manages the settings of the ODS Graphics environmentand is a statement you will probably use frequently in your SAS sessions. For example, theODS GRAPHICS statement provides options that control the physical aspects of yourgraphs, such as the image size and the name of the image file that is created for the graph.

The default image size of 640 pixels by 480 pixels (4:3 aspect ratio) for ODS Graphics isset in the SAS Registry. You can change the image size using the WIDTH= option, or theHEIGHT= option, or both in the ODS GRAPHICS statement. To name the output imagefile, use the IMAGENAME= option.

The following ODS GRAPHICS statement sets a 320 pixel width for the graph and namesthe output image file modelfit:

ods graphics / width=320px imagename="modelfit" reset;

proc sgrender data=sashelp.class template=modelfit;run;

ods graphics off;

• The WIDTH= option sets the image width to 320 pixels. Because no HEIGHT= optionis used, SAS uses the design aspect ratio of the graph to compute the appropriate height.(The width of 320px is half the default width, so SAS sets the height to 240px, whichis half the default height.)

• The IMAGENAME= option sets the name of the output image file to modelfit. TheRESET option ensures that each time the graph is produced, the previous version ofthe image file is replaced. Otherwise, image names are incremented (modelfit1,modelfit2, and so on) every time the graph is produced.

In general, it is good practice to specify only one sizing option without the other—just theWIDTH= option or just the HEIGHT= option. That way SAS can maintain the designaspect ratio of the graph, which might be important for many graphs. For example, a graph

116 Chapter 12 • Key Concepts for Using Plots

Page 127: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

that has multiple columns or a statistics table on the side needs a wide aspect ratio.Specifying both width and height in such cases might produce unpredictable results.

Note: Size settings in the ODS GRAPHICS statement affect all of the graphs that arerendered in the SAS session, unless they are changed by another ODS GRAPHICSstatement. The size for a graph produced by an individual template can be set with theDESIGNWIDTH= and DESIGNHEIGHT= options in the BEGINGRAPH statement.Size settings in the ODS GRAPHICS statement override size settings in theBEGINGRAPH statement and remain in effect unless they are changed on another ODSGRAPHICS statement or ODS GRAPHICS are turned off.

For more information about using the ODS GRAPHICS statement in GTL, seeSAS/GRAPH: Graph Template Language User's Guide. For a more complete discussionof the ODS GRAPHICS statement, see SAS Output Delivery System: Procedures Guide .

Display Attributes

OverviewThe display attributes for the lines, colors, marker symbols, and text used in a graph arederived from the ODS style that is in effect when the graph is produced. These displayattributes might also be influenced by grouped data. To override default display attributes,all GTL plot statements provide options that manage the graph’s visual appearance. Forexample, a BOXPLOT statement provides an OUTLIERATTRS= option that manages thevisual appearance of outliers.

Two ways are generally available for modifying a graph’s display attributes:

• Change the ODS style that is in effect for the graph. “ODS Styles” on page 16 providesan overview of the use of styles in a graph, and the usage guide discusses the use ofstyles in more detail.

• Override default style settings using GTL statement options. Some examples are givenin the sections that follow.

Display Attributes for Non-Grouped Data“Display Attributes” on page 563 documents the attribute settings that can be specifiedfor the lines, data markers, text, or area fills in a plot. The defaults for these attributes aredefined on style elements, but you can use attribute options on the plot statement to changethe defaults.

For example, the LINEPARM statement provides a LINEATTRS= option that specifiesthe color, line pattern, or line thickness of the plot line. For non-grouped data, if you donot set a line pattern in your template, then the default line pattern for the plot is obtainedfrom the GraphDataDefault:LineStyle style reference.

To change the default line pattern, a PATTERN= suboption on LINEATTRS= is available.Display 12.1 on page 118 shows the most common line patterns available for thePATTERN= suboption.

Display Attributes 117

Page 128: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Display 12.1 "Common Line Patterns"

• the left column shows the names for the line patterns

• the center column illustrates the type of line the name requests

• the right column shows the SAS/GRAPH line-style numbers for the line patterns

“Available Line Patterns” on page 566 provides the complete list of line patterns that canbe used with the GTL.

In the following template definition, the LINEPARM statement’s LINEATTRS= optionoverrides the default line pattern by specifying PATTERN=DASH:

proc template; define statgraph patternchange; begingraph; layout overlay; scatterplot y=height x=weight; lineparm yintercept=intercept slope=slope / lineattrs=(pattern=dash); endlayout; endgraph; end;

Other display options can be managed the same way. For example, the SCATTERPLOTstatement provides a MARKERATTRS= option that specifies the color, size, symbol, andweight of the plot data markers. For non-grouped data, if you do not set a marker symbolin your template, then the default marker symbol is obtained from theGraphDataDefault:MarkerSymbol style reference.

To change the default marker symbol, a SYMBOL= suboption on MARKERATTRS= isavailable. Display 12.2 on page 118 shows the marker symbols available for theSYMBOL= suboption.

Display 12.2 "Marker Symbols"

118 Chapter 12 • Key Concepts for Using Plots

Page 129: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

In the following template definition, the SCATTERPLOT statement’s MARKERATTRS=option overrides the default marker symbol by specifying SYMBOL=CIRCLEFILLED,which uses a filled circle to represent the data points.

proc template; define statgraph symbolchange; begingraph; layout overlay; scatterplot y=height x=weight / markerattrs=(symbol=circlefilled); endlayout; endgraph; end;

Display Attributes for Grouped Data“Display Attributes” on page 563 documents the attribute settings that you can specify forthe lines, data markers, text, or area fills in a plot. For grouped data (when you use theGROUP= option on a plot statement), each distinct group value can be represented in thegraph by a different combination of line pattern, color, and marker symbol (depending onthe graph type). The defaults for these features are set by the LineStyle, Color,ContrastColor, and MarkerSymbol attributes of the GraphData1 - GraphDataN styleelements.

Display 12.1 on page 118 shows the common line patterns available, and Display 12.2 onpage 118 shows the marker symbols available.

For grouped plots, the style in effect and the plot settings determine which line patterns,area fills, and plot symbols are used. If different line patterns, colors, and/or marker symbolsare used to represent group values, then the style determines the sequences or each that areused for the group values (as discussed in “Cycling Through Group Attributes in OverlaidPlots” on page 121, other plot settings might also influence the sequence). The sequenceis repeated as many times as needed to provide a line pattern, color, and/or marker symbolfor each group value.

You can use attribute options on the plot statement to change the default display attributesused for group data. For example, in the following template definition, the LINEPARMstatement’s LINEATTRS= option specifies PATTERN=DASH. This explicit settingoverrides the default line rotation for the plot lines and uses dashed lines for all of the plots,leaving color to distinguish among group values.

proc template; define statgraph dashedline; begingraph; layout overlay; scatterplot y=height x=weight / group=gender; lineparm yintercept=intercept slope=slope / group=gender lineattrs=(pattern=dash); endlayout; endgraph; end;

Rather than setting the same line pattern on all group values, you can change the defaultsequence of line patterns that is used for grouped values. To do so, set the LineStyle attributein each of the style elements GraphData1 through GraphDataN.

In the following example, a style is defined to change the default line pattern for the firsttwo lines in the pattern sequence. The style is derived from the DEFAULT style (the defaultstyle for the ODS HTML destination). Values are set for the LineStyle attributes in the

Display Attributes 119

Page 130: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

GraphData1 and GraphData2 style elements. The first default line in the sequence has longdashes (style value 6) and the second line has short dashes (style value 4). The LineStylesettings for the remaining GraphData elements are not set and so are derived from the parentstyle (DEFAULT). This new line sequence is used as the default line sequence for any plotthat uses the MyDefault style.

proc template; define style Styles.MyDefault; parent=Styles.Default;

style GraphData1 / LineStyle=6; style GraphData2 / LineStyle=4; end;

define statgraph testPattern; begingraph; layout overlay; scatterplot y=height x=weight / group=gender; lineparm yintercept=intercept slope=slope / group=gender lineattrs=(pattern=MyDefault); endlayout; endgraph; end;

Similarly for grouped data, you can set the MarkerSymbol attribute in each of the styleelements GraphData1 through GraphDataN. In the following example, a style is definedto change the default sequence that is used for the first three marker symbols in groupedplots. Values are set for the MarkerSymbol attributes in the GraphData1 throughGraphData3 style elements. This new sequence is used as the default marker symbolsequence for any plot that uses the MyDefault style.

proc template; define style Styles.MyDefault; parent=Styles.Default;

style GraphData1 / MarkerSymbol=DIAMOND; style GraphData2 / MarkerSymbol=CROSS; style GraphData3 / MarkerSymbol=CIRCLE; end;

define statgraph testSymbols; begingraph; layout Overlay; scatterPlot y=height x=weight / group=age markerattrs=(symbol=MyDefault); endlayout; endgraph; end;

120 Chapter 12 • Key Concepts for Using Plots

Page 131: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Cycling Through Group Attributes in Overlaid PlotsOverlay-type layouts provide the CYCLEATTRS= options that specifies whether thedefault visual attributes of lines, marker symbols, and area fills in nested plot statementsautomatically change from plot to plot. When CYCLEATTRS=TRUE, all applicable plotstatements (SCATTERPLOT, SERIESPLOT, and others) are sequentially assigned thenext unused GraphDataN style element. (The sequence is overridden for plot statementsthat have an explicit setting, either through a style element assignment or option settings.)No plot retains its default (implicit) style element.

In the following example, assuming ungrouped data, the series plots are assigned lineproperties based on the GraphData1, GraphData2, and GraphData3 style elements. Thereference line uses GraphReference, not GraphData4.

layout overlay / cycleattrs=true; seriesplot x=date y=var1; seriesplot x=date y=var2; seriesplot x=date y=var3; referenceline x=cutoff / lineattrs=GraphReference;endlayout;

If one of the plots in this example uses grouped data, the grouped plots also participate inthe default cycles. For example, if the second plot has three groups, it generates three plots,which are assigned line properties based on the GraphData2, GraphData3, and GraphData4style elements.

If the plot statement that uses grouped data also uses the INDEX= option to manage thegroup values (see “Remapping Groups for Grouped Data” on page 121), the INDEX=option overrides the default behavior. In that case, the grouped plots do not participate inthe default cycling.

When one or more of the plots within the layout override the default cycling behavior, thearrangement of the plots within the layout might affect the default mapping of theGraphDataN elements to those statements that participate in the default cycling.

Remapping Groups for Grouped DataIndexing can be used to collapse the number of groups that are represented in a graph. Forexample, if 10 groups are in the data, indexes 1 and 2 can be assigned to the first two groups,and index 3 can be assigned to all other groups. The third through tenth data groups aretreated as a single group in the graph.

Indexing can control the order in which colors, area fills, marker symbols, and line stylesare mapped to group values in a graph. This ordering method is needed only forcoordinating the data display of multiple graphs when the default mapping would causegroup values to be mismatched between graphs.

For example, consider two studies of three drugs, A, B, and C. If Study 1 uses all threedrugs, then the first combination of color and marker symbol is mapped to Drug A. Thesecond combination of color and marker symbol is mapped to Drug B, and the third ismapped to Drug C. If Study 2 omits Drug A, then the first combination of color and markersymbol is mapped to Drug B, and the second is mapped to Drug C. If the two graphs areviewed together, then this default mapping causes the group values to be mismatched. Thevisual attributes that represent Drug A in the first graph represent Drug B in the secondgraph. Those that represent Drug B in the first graph represent Drug C in the second group.

Display Attributes 121

Page 132: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The GROUP= option mappings can be made consistent between the two graphs by creatingan index column for each study. For these example studies, the GROUP and INDEXcolumns are the following:

Table 12.1 Study 1

Drug1 Index1

A 1

B 2

B 2

C 3

Table 12.2 Study 2

Drug2 Index2

B 2

C 3

C 3

If the graph for Study 1 specifies INDEX=INDEX1 and the graph for Study 2 specifiesINDEX=INDEX2, then the second combination of color and marker symbol is mapped toDrug B in both graphs. The third combination of color and marker symbol is mapped toDrug C in both graphs.

Interactions Between OptionsWhen you use GTL statement options to manage the graph display, interactions betweenoptions might cause some option settings to be ignored. For example, an ENTRYTITLEstatement provides BORDER= and BORDERATTRS= options for managing a border linearound the graph title. Border attributes that are set on the BORDERATTRS= option haveno effect on the graph title unless the title border line is displayed by settingBORDER=TRUE.

Similarly, if a BOXPLOT statement’s DISPLAY= option suppresses the display of outliersin a box plot, then using the OUTLIERATTRS= option to set outlier attributes has no effect.The OUTLIERATTRS= settings only take effect if DISPLAY= enables the display ofoutliers.

The option interactions are not limited to options that simply manage visual elements. Forexample, on a BOXPLOT, if the EXTREME= option extends the box whiskers beyond thefences, then outliers are suppressed in the plot and options that affect the outliers areignored, if set.

The documentation for each GTL statement identifies the option interactions that mightoccur on that statement.

122 Chapter 12 • Key Concepts for Using Plots

Page 133: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Location and Position of Curve Labels

OverviewOn plots that generate a curve line (a series plot or a density plot, for example), you canspecify a label for the curve line. You can also determine the label’s location in the graph.For example, the SERIESPLOT statement provides the following options for managing acurve label:

CURVELABELSpecifies a label for the curve line.

CURVELABELLOCATIONSpecifies the location of the curve line label relative to the plot area.

CURVELABELPOSITIONSpecifies the position of the label relative to the curve line.

Curve Label Location Relative to the Plot AreaBy default, the label for a curve line is displayed inside of the plot area. The followingfigure shows the default location of the label for a series plot labeled “Curve Label”:

Depending on the shape of the curve line, its distribution of values, and the other plotelements that must be displayed within the plot area, GTL might have to add an offset (see“Adjusting Axis Offsets” on page 403) to one of the plot’s axis lines to provide enoughroom for the curve label. To prevent the offset of the axis line, you can move the curvelabel outside of the plot area by specifying CURVELABELLOCATION=OUTSIDE onthe plot statement:

Location and Position of Curve Labels 123

Page 134: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Regardless of whether the curve label is displayed inside or outside of the plot area, youcan use the CURVELABELPOSITION= option to adjust the label’s position relative tothe curve line.

Curve Label Position Relative to the Curve LineGiven a curve label’s location inside or outside of the plot area, a plot statement’sCURVELABELPOSITION= option can adjust the label’s position relative to the curveline. For example, the following positions are available for a series plot (for some plots,START and END are not available):

AUTOOnly used when CURVELABELLOCATION=OUTSIDE. The curve label ispositioned automatically near the end series line along unused axes whenever possible(typically Y2 or X2) to avoid collision with tick values.

MAXForces the curve label to appear near maximum series values (typically, to the right).

MINForces the curve label to appear near minimum series values (typically, to the left).

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces the curve label toappear near the beginning of the curve. Particularly useful when the curve line has aspiral shape.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces the curve label toappear near the end of the curve Particularly useful when the curve line has a spiralshape.

When CURVELABELLOCATION=INSIDE, you can choose whether to position thecurve label near the START or END of the curve, or near the minimum data values (MIN)or maximum data values (MAX). START and END use a different algorithm than MINand MAX. They are particularly useful for spiral-shaped curves whose end points do notcorrelate with the minimum and maximum data values. In those cases, START or ENDprovide “better” label locations than MIN and MAX.

When CURVELABELLOCATION=OUTSIDE and CURVELABELPOSITION=AUTO,a “good” position is automatically chosen to avoid collision with the axis information.

The following figure shows the different combinations of label locations and positions:

124 Chapter 12 • Key Concepts for Using Plots

Page 135: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• The minimum or maximum axis tick marks can be adjusted (see “Adjusting AxisOffsets” on page 403) so that the label can be placed inside the plot area. Increasinglabel length decreases the area available for displaying plots.

• When CURVLABELLOCATION=OUTSIDE, you can set theCURVELABELPOSITION to MIN or MAX, but the label might collide with the axisticks and tick values, unless you are aware of where the axes are positioned.

Location and Position of Curve Labels 125

Page 136: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

126 Chapter 12 • Key Concepts for Using Plots

Page 137: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 13

BANDPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

Description and Syntax

Creates a band plot that typically shows confidence or prediction limits.

BANDPLOT X = column | expressionLIMITLOWER = number | numeric-column | expressionLIMITUPPER = number | numeric-column | expression </option(s)>;

BANDPLOT Y = numeric-column | expressionLIMITLOWER = number | numeric-column | expressionLIMITUPPER = number | numeric-column | expression </option(s)>;

Example Program and Statement DetailsThe following sections provide a basic overview of the BANDPLOT statement.

Example GraphThe following graph was generated by the “Example Program” on page 128:

127

Page 138: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph bandplot; begingraph; entrytitle "Fit Plot for Weight"; layout overlay; bandplot x=height limitupper=uppermean limitlower=lowermean / name="band" modelname="fit" legendlabel="95% Confidence Limits"; scatterplot x=height y=weight / primary=true; seriesplot x=height y=predict / name="fit" legendlabel="Fit Line"; discretelegend "fit" "band"; endlayout; endgraph; end;run;

proc sgrender data=sashelp.classfit template=bandplot;run;

Statement SummaryA band plot can specify an X column with Y upper and lower limits, or a Y column withX upper and lower limits. If you specify the X argument, you must specifyLIMITLOWER and LIMITUPPER arguments for the Y values to apply the limits to theY axis. If you specify the Y argument, you must specify LIMITLOWER and LIMITUPPERarguments for the X values to apply the limits to the X axis.

128 Chapter 13 • BANDPLOT Statement

Page 139: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

When you use a BANDPLOT statement to display prediction or confidence limits, the bandplot can be used with another plot that specifies a fitted model. For example, it can be usedwith a series or step plot. In these cases, use the BANDPLOT option MODELNAME= orTYPE= to identify the interpolation for the band.

You can use the BANDPLOT statement in displays that are independent of other plots. Forexample, a band plot can be used to define yellow and green areas in an OVERLAYLAYOUT statement that also contains a scatter plot. This use implies concern for any ofthe scatter plot values that fall in the yellow area and comfort for any values that fall in thegreen area. For this use, the upper and lower limits would be specified by a constant.

Arguments

OverviewEither an X= or Y= argument must be specified. Only one of them can be used. In addition,the LIMITLOWER= and LIMITUPPER= arguments must be used to specify the lower andupper lines for the band.

Argument Descriptions When X= Is UsedX=column | expression

specifies X values. Numeric or character values can be used.

LIMITLOWER=number | numeric-column | expressionspecifies a constant or column representing the Y value(s) of the lower band line. If aconstant is specified, a straight line is drawn.

LIMITUPPER=number | numeric-column | expressionspecifies a constant or column representing the Y value(s) of the upper band line. If aconstant is specified, a straight line is drawn.

Argument Descriptions When Y= Is UsedY=column | expression

specifies Y values. Numeric or character values can be used.

LIMITLOWER=number | numeric-column | expressionspecifies a constant or column representing the X value(s) of the lower band line. If aconstant is specified, a straight line is drawn.

LIMITUPPER=number | numeric-column | expressionspecifies a constant or column representing the X value(s) of the upper band line. If aconstant is specified, a straight line is drawn.

Options

Statement Option Description

CONNECTORDER Specifies how to connect the data points to formthe band lines.

CURVELABELATTRS Specifies the color and font attributes of theupper and lower band labels.

CURVELABELLOWER Specifies a label for the lower band limit.

Example Program and Statement Details 129

Page 140: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

CURVELABELUPPER Specifies a label for the upper band limit.

CURVELABELLOCATION Specifies the location of the band labels relativeto the plot area.

CURVELABELPOSITION Specifies the position of the band labels relativeto the curve line.

DATATRANSPARENCY Specifies the degree of the transparency of theband.

DISPLAY Specifies whether to display an outlined bandarea, a filled band area, or an outlined and filledband area.

EXTEND Specifies whether a constant band is to bedrawn to the area bounded by the axes.

FILLATTRS Specifies the appearance of the band area.

GROUP Creates a separate band plot for each uniquegroup value of the specified column.

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

JUSTIFY Specifies the location of the data point relativeto the step when TYPE=STEP

LEGENDLABEL Specifies the label for use in a legend.

MODELNAME Specifies the name of the plot from which toderive the interpolation of the band.

NAME Assigns a name to a plot statement for referencein other template statements.

OUTLINEATTRS Specifies the properties of the band lines.

ROLENAME Specifies roles for information defined by datacolumns.

TIP Specifies the information to display when thecursor is positioned over a graph element.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

TYPE Specifies how the data points of the lower andupper limits are joined.

130 Chapter 13 • BANDPLOT Statement

Page 141: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CONNECTORDER=VALUES | AXISspecifies how to connect the data points to form the band lines.

Default: VALUES

VALUESConnects data points in the order read from the X variable (or Y variable).

AXISConnects data points as they occur left-to-right along the X axis (or bottom-to-topalong the Y axis).

Use CONNECTORDER= to assure the expected connect order for certain types ofseries lines (for example, time series ) when the input data might not be sorted by theX variable (or Y variable).

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the band labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphValueText style element.

• For grouped data, text color is derived from the GraphData1:ContrastColor -GraphDataN:ContrastColor style references. The font is derived from theGraphValueText style element.

CURVELABELLOWER= "string" | columnspecifies a label for the lower band limit.

Default: no default

Interaction: For non-grouped data, use "string".

Interaction: For grouped data, use a column to define the lower band labels for eachgroup value. All of the labels for a specific group value must be the same. Otherwise,the results are unpredictable.

The font and color attributes for the label are specified by theCURVELABELATTRS= option.

CURVELABELUPPER= "string" | columnspecifies a label for the upper band limit.

Default: no default

Interaction: For non-grouped data, use "string".

Interaction: For grouped data, use a column to define the upper band labels for eachgroup value. All of the labels for a specific group value must be the same. Otherwise,the results are unpredictable.

Example Program and Statement Details 131

Page 142: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The font and color attributes for the label are specified by theCURVELABELATTRS= option.

CURVELABELLOCATION= INSIDE | OUTSIDEspecifies the location of the band labels relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the BANDPLOT is used in multicelllayouts such as LATTICE, DATAPANEL, or DATALATTICE where axes might beexternal to the grid.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the band labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

CURVELABELPOSITION=AUTO | MAX | MIN |START | ENDSpecifies the position of the band labels relative to the curve line.

Default: AUTO when CUVELABELLOCATION=OUTSIDE. END whenCURVELABELLOCATION=INSIDE.

AUTOOnly used when CURVELABELLOCATION=OUTSIDE. Band labels arepositioned automatically near the band boundary along unused axes wheneverpossible (typically Y2 and X2).

MAXForces the band labels to appear near maximum band values (maximum-values forhorizontal curves, and maximum Y-values for vertical curves).

MINForces the band label to appear near minimum band values (minimum X-values forhorizontal curves, and minimum Y-values for vertical curves)

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces band labels toappear near the beginning of the curve. Particularly useful when the curve line hasa spiral shape.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces band labels toappear near the end of the curve. Particularly useful when the curve line has a spiralshape.

Restriction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified. The START and END settings arenot supported if CURVELABELLOCATION=OUTSIDE is specified.

Interaction: This option is used in conjunction with theCURVELABELLOCATION= option to determine where the band labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the band. This option affects both the filland outline.

Default: 0

132 Chapter 13 • BANDPLOT Statement

Page 143: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | ( display-options )specifies whether to display an outlined band area, a filled band area, or an outlinedand filled band area.

Default: The value of the DisplayOpts attribute of the GraphBand style element, whichis DisplayOpts="FILL" by default.

STANDARDdisplays filled band with no outline

ALLdisplays an outlined, filled band

(display-options)a list of space-delimited options, enclosed in parentheses, that must include one ofthe following:

OUTLINE—displays an outlined band

FILL—displays a filled band

Use the OUTLINEATTRS= and FILLATTRS= options to control the appearance ofthe band.

EXTEND=booleanspecifies whether the constant or "step" band is to be drawn to the area bounded by theaxes.

Default: FALSE

Requirement: When this option is used for a constant band, constants must be specifiedfor the upper and lower band limits. This requirement does not apply to "step" bands.

Restriction: This option is ignored if the X or Y value is character.

If this option is not specified, then there can be a small gap between the line and theaxis. The gap is controlled by the axis offset. If the offset is set to 0, then there is nogap.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the filled band area. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Fill Options” onpage 564 for available fill-options.

Default:

• For non-grouped data, the GraphDataDefault:Color style reference.

• For grouped data, the Color attribute of GraphData1 - GraphDataN styleelements.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

GROUP=column | expressioncreates a separate band plot for each unique group value of the specified column.

Default:

• If the band outline is enabled by the ODS style or the DISPLAY= option, eachdistinct group value is represented in the graph by a different combination of outlinecolor (defined by the GraphData1:ContrastColor - GraphDataN:ContrastColorstyle references) and outline pattern (defined by the attribute of theGraphData1:LineStyle - GraphDataN:LineStyle style references).

Example Program and Statement Details 133

Page 144: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• If the band fill is enabled by the ODS style or the DISPLAY= option, each distinctgroup value is represented in the graph by a different fill color (defined by theGraphData1:Color - GraphDataN:Color style references).

Restriction: This option can be used only when a numeric column is specified for theupper limit or the lower limit of the band plot. The other limit could be a constant, ifdesired.

Interaction: To label grouped band plots, you must specifyCURVELABELLOWER==column and CURVELABELUPPER==column.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of colors and line patterns.

The representations that are used to identify the groups can be overridden individually.For example, each distinct group value is represented by a different line pattern for theband lines, but the PATTERN= suboption of the OUTLINEATTRS= option could beused to assign the same line pattern to all band outlines.

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Restriction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: The index values are 1-based indices. For the style definitions inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style to use.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

JUSTIFY=LEFT | CENTER | RIGHTspecifies the location of the data point relative to the step.

Default: LEFT

Requirement: TYPE= must also be specified for this option to have any effect.

Interaction: If the MODELNAME= option is specified, this option is ignored.

LEGENDLABEL= "string"specifies the label of the legends.

Default: The string specified on the NAME= option.

Interaction: If the GROUP= option is specified, this option is ignored.

MODELNAME= "plot-name"specifies the name of the plot from which to derive the interpolation for the band.

Default: no default

134 Chapter 13 • BANDPLOT Statement

Page 145: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Requirement: plot-name must be the name that has been assigned on the associatedplot’s NAME= option.

Interaction: This option overrides the JUSTIFY= and TYPE= options.

If this option is not specified, then the interpolation is set by the TYPE= option.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the band outlines. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the ContrastColor and LineStyle attributes of the GraphData1 -GraphDataN style elements.

Interaction: For this option to have any effect, the outline must be enabled by the ODSstyle or the DISPLAY= option.

ROLENAME=( role-name-list )specifies user-defined roles for information contained in data columns.

Default: no default

(role-name-list)a blank-separated list of role-name = column pairs.

For example, ROLENAME= ( TIP1=OBS ) assigns the column OBS to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X, Y, LIMITUPPER, LIMITLOWER, GROUP,CURVELABELUPPER, and CURVELABELLOWER.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

TIP=(role-list)specifies the information to display when the cursor is positioned over the band plot.If this option is used, it replaces all the information displayed by default. Roles forcolumns that do not contribute to the band plot can be specified along with roles thatdo.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X, Y, LIMITUPPER, LIMITLOWER, and GROUP.

Example Program and Statement Details 135

Page 146: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

(role-list)an ordered, blank-separated list of unique BANDPLOT and user-defined roles.BANDPLOT roles include X, Y, LIMITUPPER, LIMITLOWER, GROUP,INDEX, CURVELABELUPPER, and CURVELABELLOWER.

Note: CURVELABELUPPER and CURVELABELLOWER are considered rolesonly when they are assigned a column of values. They are not considered rolesand do not display tooltips when assigned a string.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles X,LIMITUPPER, and LIMITLOWER as well as the column OBS, which is notassigned to any pre-defined BandPlot role. The OBS column must first be assigneda role.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X LIMITUPPER LIMITLOWER)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of role-name = format pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X LIMITUPPER LIMITLOWER) TIPFORMAT=( LIMITUPPER= 5.3 LIMITLOWER= 5.3 )

Requirement: This option provides a way to control the formats of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of role-name = "string" pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X LIMITUPPER LIMITLOWER) TIPLABEL=( LIMITUPPER="90% CLU" LIMITLOWER="90% CLL" )

Requirement: This option provides a way to control the labels of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

136 Chapter 13 • BANDPLOT Statement

Page 147: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TYPE= SERIES | STEPspecifies how the data points for lower and upper band boundaries are interpolated.

Default: SERIES

SERIESThe data points are joined directly using line segments (as in a SeriesPlot).

STEPThe data points are connected using a step function (as in a StepPlot).

Interaction: TYPE=STEP must be specified to enable the JUSTIFY= option.

Interaction: If the MODELNAME= option is specified, this option is ignored.

XAXIS=X | X2specifies whether data are mapped to the primary X (left) axis or to the secondary X2(right) axis.

Default: X

Interaction: This option is ignored if the X= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (bottom) axis or to the secondaryY2 (top) axis.

Default: Y

Interaction: This option is ignored if the Y= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 137

Page 148: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

138 Chapter 13 • BANDPLOT Statement

Page 149: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 14

BARCHART Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Description and Syntax

Creates a bar chart computed from input data.

The following syntax creates a bar chart with bars that, by default, represent frequencycounts or percents of X:

BARCHART X = column | expression </option(s)>;

The following syntax creates a bar chart with bars representing summarized values of Ycategorized by X:

BARCHART X = column | expressionY = numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 140:

139

Page 150: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph barchart; begingraph; entrytitle "Average Mileage by Vehicle Type"; layout overlay; barchart x=type y=mpg_highway / stat=mean orient=horizontal; endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=barchart;run;

Statement SummaryThe input data for the BARCHART statement is raw, unsummarized input data, and thestatement calculates appropriate summarization statistics (sum, mean, and so on).

By default, if the data values are character, the bars in the chart appear in the order in whichthe X values are present in the input data. If the data values are character, the values arepresented in ascending order. For non-grouped data, duplicated values of X are summarizedinto a unique value. All values are treated as discrete. For grouped data, the values of Xare summarized as needed (see the GROUP= option).

The BARCHART statement only performs discrete binning for a numeric X. UseHISTOGRAM to create a chart with interval binning for X.

140 Chapter 14 • BARCHART Statement

Page 151: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ArgumentsX=column | expression

specifies the column or expression for the category values. This argument is required.

Y=numeric-column | expressionspecifies the numeric column or expression for the response values. This argument isoptional.

Options

Statement Option Description

BARLABEL Specifies whether the bar statistic value isdisplayed at the end of the bar.

BARLABELATTRS Specifies the text properties of the bar label text.

BARLABELFORMAT Specifies the text format used to display the barlabel.

BARWIDTH Specifies the bar width as a ratio of themaximum width.

CONNECTATTRS Specifies the properties of the line connectingbars.

DATATRANSPARENCY Specifies the degree of the transparency of thebar fill, bar outline, error bars, and connect line,if displayed.

DISCRETEOFFSET Specifies an amount to offset all bars from thecategory midpoints.

DISPLAY Specifies which bar features are displayed.

FILLATTRS Specifies the appearance of the filled bar area.

GROUP Creates a separate segment within each bar foreach unique group value of the specifiedcolumn.

GROUPORDER Specifies the sorting order of grouped bars.

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies the label of the legends.

NAME Assigns a name to a plot statement for referencein other template statements.

Example Program and Statement Details 141

Page 152: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

ORIENT Specifies the orientation of the Y axis and thebars.

OUTLINEATTRS Specifies the properties of the bar outlines.

PRIMARY Specifies that the data columns for this chartand the chart type be used for determiningdefault axis features.

STAT Specifies the statistic to be computed for the Y-axis.

TIP Specifies the information to display when thecursor is positioned over a bar.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

URL Specifies an HTML page to display when a baris selected.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

BARLABEL=booleanspecifies whether the bar statistic value is displayed at the end of the bar.

Default: FALSE

TIP: The font and color attributes for the label are specified by theBARLABELATTRS= option. The text format is specified by theBARLABELFORMAT= option.

BARLABELATTRS=style-element | style-element (text-options) | (text-options)specifies the text properties of the bar label text. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options” onpage 566 for available text-options.

Default: The GraphDataText style element.

Interaction: For this option to take effect, BARLABEL=TRUE must be specified.

BARLABELFORMAT=formatspecifies the text format used to display the bar label.

Default: The column format assigned to the Y= variable or BEST6.2 if no format isassigned.

Interaction: For this option to take effect, BARLABEL=TRUE must be specified.

142 Chapter 14 • BARCHART Statement

Page 153: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

BARWIDTH=numberspecifies the width of a bar as a ratio of the maximum possible width.

Default: .85. By default, the bar width automatically adjusts based on the number ofbars to be displayed and the wall width.

Range: 0 (narrowest) to 1 (widest)

This option is needed only to change the default behavior. For example, to remove anyinter-bar gap, set BARWIDTH=1.

CONNECTATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the bar connect lines. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphConnectLine style element.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the bar fill, bar outline, error bars, andconnect line, if displayed.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISCRETEOFFSET=numberspecifies an amount to offset all bars from the category midpoints.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

Default: 0 (no offset, all bars are centered on the category midpoints)

Range: -0.5 to +0.5, where .5 represents half the distance between category ticks.Normally, a positive offset is to the right when ORIENT=VERTICAL, and up whenORIENT=HORIZONTAL. (If the layout's axis options set REVERSE=TRUE, thenthe offset direction is also reversed.)

Details: This feature is useful for graphing multiple response variables side by side ona common axis. By default within an overlay-type layout, if multiple BARCHARTstatements are used with different response variables, the bars for matching categoryvalues are centered on the midpoints and the bars are superimposed. To make it easierto distinguish among superimposed bars, you can assign a different BARWIDTH=setting to each BARCHART statement in the overlay:

layout overlay / cycleattrs=true xaxisopts=(display=(tickvalues)) yaxisopts=(label="Revenue" offsetmax=0.2);

barchart x=year y=A_revenue / stat=sum name="A" legendlabel="A" barwidth=0.8 ; barchart x=year y=B_revenue / stat=sum name="B" legendlabel="B" barwidth=0.6 ; barchart x=year y=C_revenue / stat=sum name="C" legendlabel="C" barwidth=0.4 ;

discretelegend "A" "B" "C" / title="Product:" location=inside halign=right valign=top;endlayout;

Example Program and Statement Details 143

Page 154: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

To place the different response values side by side, you can assign a different offset toeach BARCHART statement. If desired, the BARWIDTH= option can be used inconjunction with DISCRETEOFFSET= to create narrower bars that require less widthwithin the plot area:

layout overlay / cycleattrs=true xaxisopts=(display=(tickvalues)) yaxisopts=(label="Revenue" offsetmax=0.2);

barchart x=year y=A_revenue / stat=sum name="A" legendlabel="A" discreteoffset=-0.3 barwidth=0.3 ; barchart x=year y=B_revenue / stat=sum name="B" legendlabel="B" discreteoffset=0 barwidth=0.3 ; barchart x=year y=C_revenue / stat=sum name="C" legendlabel="C" discreteoffset=+0.3 barwidth=0.3 ;

discretelegend "A" "B" "C" / title="Product:" location=inside halign=right valign=top;endlayout;

Different combinations of DISCRETEOFFSET and BARWIDTH can be used to getthe effect that you want. Gaps can be created between bars by providing a narrower barwidth. Or, bars can be overlapped if the bar widths are increased in proportion to thediscrete offset.

layout overlay / cycleattrs=true xaxisopts=(display=(tickvalues)) yaxisopts=(label="Revenue" offsetmax=0.2);

144 Chapter 14 • BARCHART Statement

Page 155: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

barchart x=year y=A_revenue / stat=sum name="A" legendlabel="A" datatransparency=0.2 discreteoffset=-0.2 barwidth=0.5 ; barchart x=year y=B_revenue / stat=sum name="B" legendlabel="B" datatransparency=0.2 discreteoffset=0 barwidth=0.5 ; barchart x=year y=C_revenue / stat=sum name="C" legendlabel="C" datatransparency=0.2 discreteoffset=+0.2 barwidth=0.5 ;

discretelegend "A" "B" "C" / title="Product:" location=inside halign=right valign=top;endlayout;

DISPLAY=STANDARD | ALL | ( display-options )specifies which bar features to display.

Default: STANDARD

STANDARDdisplays outlined, filled bars

ALLdisplays outlined, filled bars, and connect lines, and error bars

(display-options)a list of options, enclosed in parentheses, that must include one of the following:

OUTLINE—displays outlined bars

FILL—displays filled bars

CONNECT—Displays line segments connecting adjacent midpoints at the end ofeach bar

Restriction: Connect lines are not drawn for grouped data.

Use the OUTLINEATTRS= and FILLATTRS= options to control the appearance ofthe bars. Use CONNECTATTRS= to control the appearance of the connect lines.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the filled bar area. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Fill Options” onpage 564 for available fill-options.

Default:

• For non-grouped data, the GraphDataDefault:Color style reference.

Example Program and Statement Details 145

Page 156: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• For grouped data, the Color attribute of GraphData1 - GraphDataN styleelements.

GROUP=column | expressioncreates a separate bar segment for each unique group value of the specified column.For example, the sashelp.cars data used in the “Example Program” on page 140contains a column named ORIGIN, which identifies the region that produces each car.If this option were used on the example program’s BARCHART statement, as shownin the following code, the bars in the chart would display a separate bar segment torepresent the regions that manufactured each type of car:

layout overlay; barchart x=type y=mpg_highway / stat=mean orient=horizontal group=origin name="grouped"; discretelegend "grouped"; endlayout;

Default:

• If bar fills are enabled by the ODS style or the DISPLAY= option, each distinctgroup value is represented in the graph by a different fill color defined by theGraphData1:Color - GraphDataN:Color style references.

• If bar outlines are enabled by the ODS style or the DISPLAY= option, each distinctgroup value is represented in the graph by a different outlined color defined by theGraphData1:ContrastColor - GraphDataN:ContrastColor style references.

Interaction: Connect lines are not drawn for grouped data.

Interaction: By default, the group values are mapped in the order of the data. TheGROUPORDER= option can be used to control the sorting order of the grouped barsegments. The INDEX= option can be used to alter the default sequence of colors andline patterns.

The representations that are used to identify the groups can be overridden individually.For example, each distinct group value is represented by a different line pattern for thebar outlines, but the PATTERN= setting on the OUTLINEATTRS= option could beused to assign the same line pattern to all bar outlines and connect lines.

146 Chapter 14 • BARCHART Statement

Page 157: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

GROUPORDER=DATA | ASCENDING | DESCENDINGspecifies the ordering of bars within a group and within the legend.

Default: DATA

DATAshows each group of bars in data order of the group column.

ASCENDINGshows each group of bars in ascending order.

DESCENDINGshows each group of bars in descending order.

Interaction: This option is ignored unless GROUP= is specified.

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Restriction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: The index values are 1-based indices. For the style definitions inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style to use.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The Y-variable label. If a label is not defined, the Y-variable name.

Interaction: If the GROUP= option is specified, this option is ignored.

NAME= "string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

ORIENT= VERTICAL | HORIZONTALspecifies the orientation of the Y axis and the bars.

Default: VERTICAL

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the bar outlines. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default:

Example Program and Statement Details 147

Page 158: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• For non-grouped data, the ContrastColor and LineThickness attributes of theGraphOutlines style element.

• For grouped data, the ContrastColor and LineThickness attribute of the GraphData1- GraphDataN style elements.

Interaction: For this option to have any effect, outlines must be enabled by the ODSstyle or the DISPLAY= option.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

STAT= FREQ | PCT | SUM | MEANspecifies the statistic to be computed for the Y-axis.

Default: FREQ for bar charts with no Y=column. SUM for bar charts with a Y=column.

For bar charts with no Y= column:

FREQFrequency count

PCTPercent

For bar charts with a Y= column:

SUMSum

MEANMean

When this option is used with the GROUP=group option, the specified statistic iscomputed for each segment that is created for the unique group values.

TIP=(role-list)specifies the information to display when the cursor is positioned over a bar. If thisoption is used, it replaces all the information displayed by default.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X, Y, and GROUP.

(role-list)an ordered, blank-separated list of unique BARCHART roles. BARCHART rolesinclude X, Y, INDEX, and GROUP.

The following example displays tooltips for the columns assigned to the roles Xand Y only:

TIP= (X Y)

148 Chapter 14 • BARCHART Statement

Page 159: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of role-name = format pairs separated by blanks.

TIP=(Y) TIPFORMAT=( Y=DOLLAR12.)

Requirement: This option provides a way to control the formats of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of role-name = "string" pairs separated by blanks.

TIP=(Y) TIPLABEL=(Y="Average Sales")

Requirement: This option provides a way to control the labels of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect.

URL=character-columnspecifies an HTML page to display when the bar is selected.

Default: no default

character-columneach value of the column should be a valid HTML page reference (HREF).Example: http://www.sas.com/technologies/analytics/index.html.

Requirement: To generate selectable bars, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

For non-grouped data, the values of the column are expected to be same for each uniqueX value. If they are not, the results might be unpredictable. The URL value can be blankfor some X values, meaning that no action is taken when the bars for those X valuesare selected. The URL value can be the same for different X values, meaning that thesame action is taken when the bars for those X values are selected.

For grouped data, the values of the column are expected to be the same for each uniqueX and GROUP combination.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Example Program and Statement Details 149

Page 160: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: This option is ignored if the Y= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

150 Chapter 14 • BARCHART Statement

Page 161: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 15

BARCHARTPARM Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

Description and Syntax

Creates a bar chart specified by pre-summarized data.

BARCHARTPARM X = column | expressionY = numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 152

151

Page 162: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph barchartparm; begingraph; entrytitle "Average Mileage by Vehicle Type"; entryfootnote halign=left "Errorbars show +/- 1 Standard Error"; layout overlay; barchartparm x=type y=mean / errorlower=eval(mean-stderr) errorupper=eval(mean+stderr) ; endlayout; endgraph; end;run;

/* create summarized data for barchartparm */proc summary data=sashelp.cars nway; class type; var mpg_highway; output out=mileage mean=mean stderr=stderr ;run;

proc sgrender data=mileage template=barchartparm;run;

152 Chapter 15 • BARCHARTPARM Statement

Page 163: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement SummaryThe input data for the BARCHARTPARM statement is expected to be pre-summarized,with appropriate summarization statistics (sum, mean, and so on) computed for the Ycolumn. When the X values are not unique, the display is not meaningful.

By default, if the data values are character, the bars in the chart appear in the order in whichthe X values are present in the input data. If the data values are character, the values arepresented in ascending order.

Required ArgumentsX=column | expression

specifies the column for the unique category values. All values are treated as discrete.

Y=numeric-column | expressionspecifies the column for the response values.

Options

Statement Option Description

BARWIDTH Specifies the bar width as a ratio of themaximum width.

CONNECTATTRS Specifies the properties of the line connectingbars.

DATATRANSPARENCY Specifies the degree of the transparency of thebar fill, bar outline, error bars, and connect line,if displayed.

DISCRETEOFFSET Specifies an amount to offset all bars from thecategory midpoints.

DISPLAY Specifies which bar features are displayed.

ERRORBARATTRS Specifies the attributes of the error bars.

ERRORLOWER Specifies the values of the lower endpoints onthe error bars.

ERRORUPPER Specifies the values of the upper endpoints onthe error bars.

FILLATTRS Specifies the appearance of the filled bar area.

GROUP Creates a separate segment within each bar foreach unique group value of the specifiedcolumn.

GROUPORDER Specifies the sorting order of grouped bars.

Example Program and Statement Details 153

Page 164: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies the label of the legends.

NAME Assigns a name to a plot statement for referencein other template statements.

ORIENT Specifies the orientation of the Y axis and thebars.

OUTLINEATTRS Specifies the properties of the bar outlines.

PRIMARY Specifies that the data columns for this chartand the chart type be used for determiningdefault axis features.

ROLENAME Specifies roles for information defined by datacolumns.

TIP Specifies the information to display when thecursor is positioned over a bar.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

URL Specifies an HTML page to display when a baris selected.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

BARWIDTH=numberspecifies the width of a bar as a ratio of the maximum possible width.

Default: .85. By default, the bar width automatically adjusts based on the number ofbars to be displayed and the wall width.

Range: 0 (narrowest) to 1 (widest)

This option is needed only to change the default behavior. For example, to remove anyinter-bar gap, set BARWIDTH=1.

154 Chapter 15 • BARCHARTPARM Statement

Page 165: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

CONNECTATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the bar connect lines. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphConnectLine style element.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the bar fill, bar outline, error bars, andconnect line, if displayed.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISCRETEOFFSET=numberspecifies an amount to offset all bars from the category midpoints.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

Default: 0 (no offset, all bars are centered on the category midpoints)

Range: -0.5 to +0.5, where .5 represents half the distance between category ticks.Normally, a positive offset is to the right when ORIENT=VERTICAL, and up whenORIENT=HORIZONTAL. (If the layout's axis options set REVERSE=TRUE, thenthe offset direction is also reversed.)

Details: This feature is useful for graphing multiple response variables side by side ona common axis. By default within an overlay-type layout, if multiple BARCHARTstatements are used with different response variables, the bars for matching categoryvalues are centered on the midpoints and the bars are superimposed. To make it easierto distinguish among superimposed bars, you can assign a different BARWIDTH=setting to each BARCHARTPARM statement in the overlay:

layout overlay / cycleattrs=true xaxisopts=(display=(tickvalues)) yaxisopts=(label="Revenue" offsetmax=0.2);

barchartparm x=year y=A_revenue / name="A" legendlabel="A" barwidth=0.8 ; barchartparm x=year y=B_revenue / name="B" legendlabel="B" barwidth=0.6 ; barchartparm x=year y=C_revenue / name="C" legendlabel="C" barwidth=0.4 ;

discretelegend "A" "B" "C" / title="Product:" location=inside halign=right valign=top;endlayout;

Example Program and Statement Details 155

Page 166: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

To place the different response values side by side, you can assign a different offset toeach BARCHARTPARM statement. If desired, the BARWIDTH= option can be usedin conjunction with DISCRETEOFFSET= to create narrower bars that require lesswidth within the plot area:

layout overlay / cycleattrs=true xaxisopts=(display=(tickvalues)) yaxisopts=(label="Revenue" offsetmax=0.2);

barchartparm x=year y=A_revenue / name="A" legendlabel="A" discreteoffset=-0.3 barwidth=0.3 ; barchartparm x=year y=B_revenue / name="B" legendlabel="B" discreteoffset=0 barwidth=0.3 ; barchartparm x=year y=C_revenue / name="C" legendlabel="C" discreteoffset=+0.3 barwidth=0.3 ;

discretelegend "A" "B" "C" / title="Product:" location=inside halign=right valign=top;endlayout;

Different combinations of DISCRETEOFFSET and BARWIDTH can be used to getthe effect that you want. Gaps can be created between bars by providing a narrower barwidth. Or, bars can be overlapped if the bar widths are increased in proportion to thediscrete offset.

layout overlay / cycleattrs=true xaxisopts=(display=(tickvalues)) yaxisopts=(label="Revenue" offsetmax=0.2);

barchartparm x=year y=A_revenue / name="A" legendlabel="A" datatransparency=0.2 discreteoffset=-0.2 barwidth=0.5 ; barchartparm x=year y=B_revenue / name="B" legendlabel="B" datatransparency=0.2 discreteoffset=0 barwidth=0.5 ; barchartparm x=year y=C_revenue / name="C" legendlabel="C" datatransparency=0.2 discreteoffset=+0.2 barwidth=0.5 ;

discretelegend "A" "B" "C" / title="Product:" location=inside halign=right valign=top;endlayout;

156 Chapter 15 • BARCHARTPARM Statement

Page 167: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DISPLAY=STANDARD | ALL | ( display-options )specifies which bar features to display.

Default: STANDARD

STANDARDdisplays outlined, filled bars

ALLdisplays outlined, filled bars and also connect lines

(display-options)a list of options, enclosed in parentheses, that must include one of the following:

OUTLINE—displays outlined bars

FILL—displays filled bars

CONNECT—Displays line segments connecting adjacent midpoints at the end ofeach bar

Interaction: Connect lines are not drawn for grouped data.

Error bars are automatically displayed whenever the ERRORUPPER= orERRORLOWER= options are specified.

Use the OUTLINEATTRS= and FILLATTRS= options to control the appearance ofthe bars. Use CONNECTATTRS= to control the appearance of the connect lines.

ERRORBARATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the error bars associated with the bars. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default:

• For non-grouped data, the GraphError style element.

• For grouped data, the LineStyle and LineThickness attributes of the GraphErrorstyle element and the ContrastColor attribute of the GraphData1 - GraphDataN styleelements.

ERRORLOWER=numeric-column | expressionspecifies the values of the lower endpoints on the Y error bars.

Default: The lower segment of the error bars is not drawn.

Interaction: If the GROUP= option is specified, this option is ignored.

The error bar values must be absolute data values, not data values relative to the valueof the bar.

The appearance of the error bars is controlled by the ERRORBARATTRS= option.

Example Program and Statement Details 157

Page 168: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ERRORUPPER=numeric-column | expressionspecifies the values of the upper endpoints on the Y error bars.

Default: The upper segment of the error bars is not drawn.

Interaction: If the GROUP= option is specified, this option is ignored.

The error bar values must be absolute data values, not data values relative to the valueof the bar.

The appearance of the error bars is controlled by the ERRORBARATTRS= option.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the filled bar area. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Fill Options” onpage 564 for available fill-options.

Default:

• For non-grouped data, the GraphDataDefault:Color style reference.

• For grouped data, the GraphData1:Color - GraphDataN:Color style references.

GROUP=column | expressioncreates a separate bar segment for each unique group value of the specified column.For example, for a vertical bar chart, the segments would be stacked to form the bar,and the height of each segment would represent that group value’s proportionalcontribution to the response value.

Default:

• If bar fills are enabled by the ODS style or the DISPLAY= option, each distinctgroup value is represented in the graph by a different fill color defined by theGraphData1:Color - GraphDataN:Color style references.

• If bar outlines are enabled by the ODS style or the DISPLAY= option, each distinctgroup value is represented in the graph by a different outlined color defined by theGraphData1:ContrastColor - GraphDataN:ContrastColor style references.

Interaction: Connect lines are not drawn for grouped data.

Interaction: By default, the group values are mapped in the order of the data. TheGROUPORDER= option can be used to control the sorting order of the grouped barsegments. The INDEX= option can be used to alter the default sequence of colors andline patterns.

The representations that are used to identify the groups can be overridden individually.For example, each distinct group value is represented by a different line pattern for thebar outlines, but the PATTERN= setting on the OUTLINEATTRS= option could beused to assign the same line pattern to all bar outlines and connect lines.

GROUPORDER=DATA | ASCENDING | DESCENDINGspecifies the ordering of bars within a group and within the legend.

Default: DATA

DATAshows each group of bars in data order of the group column.

ASCENDINGshows each group of bars in ascending order.

DESCENDINGshows each group of bars in descending order.

Interaction: This option is ignored unless GROUP= is specified.

158 Chapter 15 • BARCHARTPARM Statement

Page 169: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Restriction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: The index values are 1-based indices. For the style definitions inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style to use.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The Y-variable label. If a label is not defined, the Y-variable name.

Interaction: If the GROUP= option is specified, this option is ignored.

NAME= "string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

ORIENT= VERTICAL | HORIZONTALspecifies the orientation of the Y axis and the bars.

Default: VERTICAL

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the bar outlines. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default:

• For non-grouped data, the ContrastColor and LineThickness attributes of theGraphOutlines style element.

• For grouped data, the ContrastColor and LineThickness attribute of the GraphData1- GraphDataN style elements.

Interaction: For this option to have any effect, outlines must be enabled by the ODSstyle or the DISPLAY= option.

PRIMARY=booleanspecifies that the data columns for this chart be used for determining default axisfeatures.

Default: FALSE

Example Program and Statement Details 159

Page 170: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

ROLENAME=( role-name-list )specifies user-defined roles for information contained in data columns.

Default: no default

(role-name-list)a blank-separated list of role-name = column pairs.

For example, ROLENAME= ( TIP1=PCT ) assigns the column PCT to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X, Y, ERRORLOWER, ERRORUPPER, GROUP, and INDEX.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

TIP=(role-list)specifies the information to display when the cursor is positioned over a bar. If thisoption is used, it replaces all the information displayed by default. Roles for columnsthat do not contribute to the bar chart can be specified along with roles that do.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X, Y, ERRORLOWER, ERRORUPPER, and GROUP.

(role-list)an ordered, blank-separated list of unique BARCHARTPARM and user-definedroles. BARCHARTPARM roles include X, Y, ERRORUPPER, ERRORLOWER,INDEX, and GROUP.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles Xand Y as well as the column PCT, which is not assigned to any pre-defined bar chartrole. The PCT column must first be assigned a role.

ROLENAME=(TIP1=PCT) TIP= (TIP1 X Y)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of role-name = format pairs separated by blanks.

ROLENAME=(TIP1=PCT)

160 Chapter 15 • BARCHARTPARM Statement

Page 171: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TIP=(TIP1 X Y) TIPFORMAT=( TIP1=PERCENT7.2)

Requirement: This option provides a way to control the formats of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of role-name = "string" pairs separated by blanks.

ROLENAME=(TIP1=PCT) TIP=(TIP1 X Y) TIPLABEL=( TIP1="Percent")

Requirement: This option provides a way to control the labels of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

URL=character-columnspecifies an HTML page to display when the bar is selected.

Default: no default

character-columneach value of the column should be a valid HTML page reference (HREF).Example: http://www.sas.com/technologies/analytics/index.html.

Requirement: To generate selectable bars, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

For non-grouped data, the values of the column are expected to be same for each uniqueX value. If they are not, only the first URL value for a given X value is used. The URLvalue can be blank for some X values, meaning that no action is taken when the barsfor those X values are selected. The URL value can be the same for different X values,meaning that the same action is taken when the bars for those X values are selected.

For grouped data, the values of the column are expected to be the same for each uniqueX and GROUP combination.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 161

Page 172: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

162 Chapter 15 • BARCHARTPARM Statement

Page 173: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 16

BIHISTOGRAM3DPARMStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

Description and Syntax

Creates a 3-D bivariate histogram of three variables X, Y, and Z, where values of X and Yhave been gridded. The Z variable represents a response value for the frequency, percentagecounts, or densities of each bin combination.

BIHISTOGRAM3DPARM X = numeric-column | expressionY = numeric-column | expressionZ = non-negative-numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 164:

163

Page 174: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph bihistogram; begingraph; entrytitle "Distribution of Height and Weight"; entryfootnote halign=right "SASHELP.HEART"; layout overlay3d / cube=false zaxisopts=(griddisplay=on); bihistogram3dparm x=height y=weight z=count / display=all; endlayout; endgraph; end; run;

data heart; set sashelp.heart(keep=height weight); if height ne . and weight ne .; height=round(height,5); weight=round(weight,25);run;

proc summary data=heart nway completetypes; class height weight; var height; output out=stats(keep=height weight count) N=Count;run;

proc sgrender data=stats template=bihistogram;run;

164 Chapter 16 • BIHISTOGRAM3DPARM Statement

Page 175: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement SummaryThe BIHISTOGRAM3DPARM statement does not perform a binning computation on theinput columns. Thus, you must pre-bin the data. In addition, input data for the statementmust be binned by both X and Y. That is, the values for the X column and the Y columnmust form a complete, rectangular grid of bins. Input data with non-binned columns shouldbe preprocessed with PROC KDE (SAS/STAT), which enables you to set the number ofbins for X and Y. Or the data can be preprocessed with a technique similar to the example,where a pre-defined bin width is used.

The input data for Z= column must be nonnegative. In the graph display, the direction ofthe Z axis is upwards rather than outwards.

The BIHISTOGRAM3DPARM statement must be specified within a LAYOUTOVERLAY3D statement and cannot be nested under an OVERLAY,OVERLAYEQUATED, or PROTOTYPE layout.

BIHISTOGRAM3DPARM does not support the tooltips that are enabled by theIMAGEMAP= option in the ODS GRAPHICS statement.

Required ArgumentsX=numeric-column | expression

specifies the bin location of the numeric X values.

Y=numeric-column | expressionspecifies the bin location of the numeric Y values.

Z=non-negative-numeric-column | expressionspecifies the response values, such as the frequency counts, percentages, or densities.

Options

Statement Option Description

BINAXIS Specifies whether to use bins as the basis foraxis tick marks for the X and Y axes.

DATATRANSPARENCY Specifies the degree of the transparency of thebins.

DISPLAY Specifies whether to display outlined bins,filled bins, or outlined and filled bins.

ENDLABELS Specifies whether labels are drawn at theendpoints of the X bins and Y bins.

FILLATTRS Specifies the appearance of the filled bins.

LEGENDLABEL Specifies a label for use in the legend.

NAME Assigns a name to a plot statement for referencein other template statements.

Example Program and Statement Details 165

Page 176: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

OUTLINEATTRS Specifies the appearance of the bin outlines.

PRIMARY Specifies that the data columns for this plot andthe plot type be used for determining defaultaxis features.

XVALUES Specifies whether the X values representmidpoints, lower endpoints, or upper endpointsof the bins.

YVALUES Specifies whether the Y values representmidpoints, lower endpoints, or upper endpointsof the bins.

BINAXIS=booleanspecifies whether to use bins as the basis for the X and Y axis tick marks.

Default: TRUE

FALSEStandard axes are used, ignoring bin boundaries and midpoints set by theENDLABELS= option.

TRUEThe ENDLABELS= option determines how the axis ticks and value labels aredisplayed. Some axis options for the X- and Y-axes might not apply.

Interaction: For this option to take effect, this plot must be the primary plot in theparent OVERLAY3D layout. For more information, see the PRIMARY= option.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the bins.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | ( display-options )specifies whether to display outlined bins, filled bins, or outlined and filled bins.

Default: STANDARD

STANDARDdisplays filled bins with no outlines.

ALLdisplays outlined, filled bins.

(display-options)a list of options, enclosed in parentheses, that must include at least one of thefollowing:

OUTLINE—displays outlined bins

FILL—displays filled bins

Use the OUTLINEATTRS= and FILLATTRS= options to control the appearance ofthe bins.

ENDLABELS=booleanspecifies whether labels are drawn at the endpoints of the X bins and Y bins.

166 Chapter 16 • BIHISTOGRAM3DPARM Statement

Page 177: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: FALSE. Labels are drawn at the X bin and Y bin midpoints.

Interaction: For this option to take effect, this plot must be the primary plot in theparent OVERLAY3D layout. For more information, see the PRIMARY= option.

Interaction: This option is ignored if BINAXIS=FALSE. By default,BINAXIS=TRUE.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the filled bins. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Fill Options” on page 564for available fill-options.

Default: The GraphDataDefault style element.

LEGENDLABEL= "string"specifies a label for the legend.

Default: The string specified on the NAME= option.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the bin outlines. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default: The GraphOutlines style element.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397.

XVALUES= MIDPOINTS | LEFTPOINTS | RIGHTPOINTSspecifies whether the input X values represent midpoints, lower endpoints, or upperendpoints of the bins.

Default: MIDPOINTS

YVALUES= MIDPOINTS | LEFTPOINTS | RIGHTPOINTSspecifies whether the input Y values represent midpoints, lower endpoints, or upperendpoints of the bins.

Default: MIDPOINTS

Example Program and Statement Details 167

Page 178: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

168 Chapter 16 • BIHISTOGRAM3DPARM Statement

Page 179: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 17

BLOCKPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169BlockPlot Overlaid with SeriesPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170Stand-alone BlockPlot in Lattice Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Description and Syntax

Creates one or more strips of rectangular blocks containing text values. The width of eachblock corresponds to specified numeric intervals.

BLOCKPLOTX = column | expressionBLOCK = column | expression </option(s)>;

Example Program and Statement DetailsA block plot contains information about X locations and text values to be associated withcorresponding intervals along the X axis. There is no Y axis information in this plot.

169

Page 180: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

BlockPlot Overlaid with SeriesPlot

When overlaid with plots that have a Y axis—a series plot for example—a block plotexpands vertically to fill the Y axis range. In the BLOCKPLOT statement, the BLOCK=argument can be used to reference text values from a column. The resulting graph displaysthose values within the plot wall.

The following example shows how a block plot can be specified with a series plot withinan Overlay layout. To prepare data for the graph, “event” information is added to existingdata for stock prices. Notice that the first DATA step creates a RELEASE column. Thatcolumn is later specified on the BLOCK= argument to display text values on the wall ofthe block plot.

data MSevents; input Date date9. Release $5.; label Release="Windows Release";datalines;01jun1990 3.001sep1995 9501jul1998 9801mar2000 200001nov2001 XPrun;

proc sort data=sashelp.stocks(keep=date stock close) out=MSstock; where stock="Microsoft"; by date;run;

data events(drop=temp); retain temp;

170 Chapter 17 • BLOCKPLOT Statement

Page 181: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

merge MSstock MSevents(in=r); by date; if first.date and r then temp=release; release=temp; run;

In the combined input data set, notice that the RELEASE value is repeated for eachobservation within the duration of a defined “event”:

Obs Date Close Release... 45 02APR90 $58.0046 01MAY90 $73.0047 01JUN90 $76.00 3.048 02JUL90 $66.50 3.049 01AUG90 $61.50 3.050 04SEP90 $63.00 3.0...

In the following GTL template code, BLOCK=RELEASE is specified in the BLOCKPLOTstatement so that the RELEASE values are displayed on the wall of the resulting block plot.

proc template; define statgraph blockplot1; begingraph; entrytitle "Microsoft Share Prices"; entrytitle "and Significant OS Releases"; layout overlay; blockplot x=date block=release / datatransparency=.3 valuevalign=top labelposition=top display=(fill values label); seriesplot x=date y=close; endlayout; endgraph; end;run;

proc sgrender data=events template=blockplot1;run;

Stand-alone BlockPlot in Lattice LayoutWhen used as a stand-alone plot in a lattice layout, the block plot’s height can be controlled.Here the lattice ROWWEIGHTS=(.04 .96) option apportions 4% of the vertical space tothe block plot. Using this technique, it is possible to include two or more “event” strips ina plot.

Example Program and Statement Details 171

Page 182: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

proc template; define statgraph blockplot2; begingraph; entrytitle "Microsoft Share Prices"; entrytitle "and Significant OS Releases"; layout lattice / rowweights=(.04 .96); blockplot x=date block=release / datatransparency=.3 valuefitpolicy=shrink labelposition=left display=(fill label outline values); seriesplot x=date y=close; endlayout; endgraph; end;run;

proc sgrender data=events template=blockplot2;run;

ArgumentsX=column | expression

specifies numeric X axis positions. When the X-axis is numeric and the specifiedcolumn is numeric, values are expected to be in sorted, ascending order. If the X-axisis discrete and the specified column is numeric, values are treated as numeric-discrete.

BLOCK=column | expressionspecifies a value for each X position. Numeric values are converted to text stringsaccording to an assigned format or BEST6.

172 Chapter 17 • BLOCKPLOT Statement

Page 183: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Options

Statement Option Description

ALTFILLATTRS Specifies the appearance of alternate block fills.

BLOCKINDEX Specifies indices for remapping the assignmentof color to block values.

CLASS Creates a separate block plot for each uniquevalue of the specified column or expression.

DATATRANSPARENCY Specifies the degree of the transparency of theblock fill and outline.

DISPLAY Specifies whether to display an outlined, afilled, or an outlined and filled block area.

FILLATTRS Specifies the appearance of the block fills.

FILLTYPE Specifies how the blocks are filled.

LABEL Specifies an external label for a single blockplot.

LABELATTRS Specifies the appearance of the externalBLOCK label(s).

LABELPOSITION Specifies the alignment of BLOCK label.

NAME Assigns a name to a plot statement for referencein other template statements.

OUTLINEATTRS Specifies the properties of the block outlines.

REPEATEDVALUES Specifies whether contiguous block values thatare identical create separate blocks.

VALUEATTRS Specifies the appearance of the text values.

VALUEFITPOLICY Specifies how text values are adjusted to fitwithin the containing block.

VALUEHALIGN Specifies the horizontal alignment of text withblocks.

VALUEVALIGN Specifies the vertical alignment of text withblocks.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

Example Program and Statement Details 173

Page 184: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ALTFILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of alternate fills. This option in conjunction with theFILLATTRS= option controls fill appearance when FILLTYPE=ALTERNATE. See“General Syntax for Attribute Options” on page 563 for the syntax on using a style-element and “Fill Options” on page 564 for available fill-options.

Default: The GraphWalls style element.

Requirement: FILLTYPE=ALTERNATE must set for this option to have any effect.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

Interaction: The FILLATTRS= option controls the fill color.

To make all block fill areas the same color, set the FILLATTRS= andALTFILLATTRS= options to the same value.

BLOCKINDEX=positive-integer-column | expressionspecifies indices for remapping the assignment of the color of the block fills.

Default: no default

Requirement: FILLTYPE=MULTICOLOR must set for this option to have any effect.

Interaction: All of the indexes for a specific block value must be the same. Otherwise,the results are unpredictable.

Interaction: The index values are 1-based indices. For the style definitions inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style element touse.

Interaction: If this option is not used, then the color values are mapped in the orderof GraphData1 - GraphDataN.

CLASS=column | expressioncreates a separate block plot for each unique value of the specified column orexpression. Each block plot is labeled externally by the class value.

Default: no default

Interaction: The DISPLAY= option must include LABEL for any external labels toappear.

Interaction: This option overrides the LABEL= option.

The font and color attributes for the external labels are specified by theLABELATTRS= option.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the block fill and outline. It does not affectblock values or label.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | ( display-options )specifies whether to display an outlined, a filled, or an outlined and filled block area.Values and a label can also be added or suppressed.

Default: STANDARD

STANDARD1) displays an outlined, filled block without text values or a label when usedinside an overlay-type layout (OUTLINE FILL).

174 Chapter 17 • BLOCKPLOT Statement

Page 185: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

2) displays an outlined, filled block with text values and a label when used as astand-alone plot inside a LATTICE or GRIDDED layout (OUTLINE FILLVALUES LABEL).

ALLdisplays all possible features.

(display-options)a list of options, enclosed in parentheses, that must include at least one of thefollowing:

OUTLINE—displays an outlined, non-filled block

FILL—displays a filled, non-outlined block

VALUES—displays internal block values

LABEL—displays external block label(s)

Use the OUTLINEATTRS=, FILLATTRS=, ALTFILLATTRS=, andBLOCKINDEX= options to control the appearance of the blocks.

Use the VALUEATTRS= and LABELATTRS= options to control the text appearance.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the block fills. This option in conjunction with theALTFILLATTRS= option controls fill appearance when FILLTYPE=ALTERNATE.See “General Syntax for Attribute Options” on page 563 for the syntax on using astyle-element and “Fill Options” on page 564 for available fill-options.

Default: The GraphData1 style element.

Requirement: FILLTYPE=ALTERNATE must set for this option to have any effect.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

Interaction: The ALTFILLATTRS= option controls the alternating fill color.

To make all block fill areas the same color, set the FILLATTRS= andALTFILLATTRS= options to the same value.

FILLTYPE=MULTICOLOR | ALTERNATEspecifies how the blocks are filled.

Default: MULTICOLOR

MULTICOLORBlocks are filled with the COLOR attribute of the style elements GraphData1 -GraphDataN or the style elements indicated by the BLOCKINDEX= column.

ALTERNATEBlocks are filled alternating between the colors specified by the FILLATTRS= andALTFILLATTRS= options.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

Interaction: When this option is set to ALTERNATE, the block plot does not supporta DISCRETELEGEND entry.

LABEL= "string"specifies an external label for a single block plot.

Default:

• The variable label of the BLOCK= column.

Example Program and Statement Details 175

Page 186: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• The variable name of the BLOCK= column, if there is no variable label.

Interaction: If the CLASS= option is specified, this option is ignored.

Interaction: The DISPLAY= option must include LABEL for any external label(s) toappear.

The font and color attributes for the external label are specified by theLABELATTRS= option.

LABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the external block label(s). See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphLabelText style element.

LABELPOSITION=LEFT | RIGHT | TOP | BOTTOMspecifies the alignment of BLOCK label.

Default: LEFT

LEFTPlaces the label to the left of the strip of block values.

RIGHTPlaces the label to the right of the strip of block values.

TOPPlaces the label above the strip of block values.

BOTTOMPlaces the label below the strip of block values.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the block outlines. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphOutlines style element.

Interaction: For this option to have any effect, the outlines must be enabled by theODS style or the DISPLAY= option.

Interaction: If labels are displayed in the TOP or BOTTOM position, they are alsooutlined.

REPEATEDVALUES=booleanspecifies whether contiguous block values that are identical create separate blocks.

Default: FALSE

FALSEIf two or more identical block values appear consecutively, only one block is createdfor them.

TRUEIf two or more identical block values appear consecutively, a separate block iscreated for each of them.

176 Chapter 17 • BLOCKPLOT Statement

Page 187: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

VALUEATTRS=style-element | style-element (text-options) | (text-options)specifies the appearance of the text values. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Text Options” on page566 for available text-options.

Default: The GraphValueText style element.

VALUEFITPOLICY=TRUNCATE | SHRINKspecifies how text values are adjusted to fit within the containing block.

Default: TRUNCATE

TRUNCATEAny value that does not fit is truncated. For a numeric column, an asterisk ( * ) issubstituted for the entire value whenever truncation occurs. For a character column,the truncated portion of the text is replaced by an ellipsis (...).

SHRINKAll values are reduced in font size until they all fit.

VALUEHALIGN=LEFT | CENTER | RIGHT | STARTspecifies the horizontal alignment of the text within the blocks.

Default: LEFT

LEFTLeft-aligned within the block

CENTERCenter-aligned within the block

RIGHTRight-aligned within the block

STARTCenter-aligned at the starting value of the block

Interaction: For this option to have any effect, the DISPLAY= option must includeVALUE.

Interaction: When REPEATEDVALUES=TRUE and X values are numeric, onlyCENTER and START can be used for a discrete axis, and only LEFT and START canbe used for a linear or log axis. For example, if REPEATEDVALUES=TRUE and theaxis is discrete, a setting of RIGHT for this option is ignored and LEFT is used instead.

VALUEVALIGN=TOP | CENTER | BOTTOMspecifies the vertical alignment of the text within the blocks.

Default: CENTER

Interaction: For this option to have any effect, the DISPLAY= option must includeVALUE.

If the DISPLAY= option also includes LABEL, the label has the same verticalalignment.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 177

Page 188: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

178 Chapter 17 • BLOCKPLOT Statement

Page 189: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 18

BOXPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

Description and SyntaxCreates box-and-whisker plot(s) computed from input data.

BOXPLOT Y = numeric-column | expression </option(s)>;

BOXPLOT X = column | expressionY = numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 180:

179

Page 190: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph boxplot; begingraph; entrytitle "City Mileage for Vehicle Types"; layout overlay; boxplot y=mpg_city x=type / datalabel=make spread=true; endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=boxplot; label type="Vehicle Type";run;

Statement SummaryThe BOXPLOT statement displays a single box if given just a Y argument. It displaysmultiple boxes if given both Y and X arguments and X has more than one unique value.For numeric or character columns, the X-axis is always of TYPE=DISCRETE.

Two basic box plot representations can be drawn with the BOXPLOT statement: aschematic (Tukey) box plot and a skeletal box plot. See the EXTREME= option for details.

The following figure illustrates the box plot elements:

180 Chapter 18 • BOXPLOT Statement

Page 191: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

As shown in the figure, the bottom and top edges of the box are located at the 25th and75th percentiles of the sample. Within the box you can display the median (50th percentile)as a line and the mean as a marker (see DISPLAY= option).

You can also display markers and data labels for outliers. Outliers are observations that aremore extreme than the upper and lower fences ( ± 1.5IQR ). Outliers that are beyond upperand lower far fences ( ± 3 IQR ) are called FAR OUTLIERS and can also be identified andlabeled. From a graphical perspective, the location of fences along the axis are known, butthere is no line or marker that displays a fence. (See DISPLAY=, LABELFAR=, andDATALABEL= options).

Finally, you can control the range represented by the whiskers. By default, the whiskersare drawn from the upper edge of the box to the MAX value, and from the lower edge ofthe box to the MIN value (see EXTREME= option).

ArgumentsY=numeric-column | expression

specifies the column for the Y values. This argument is required.

X=column | expressionspecifies the column for the X values. This column is used to create a box plot for eachunique X value and is optional.

Options

Statement Option Description

BOXWIDTH Specifies the width of a box as a ratio of themaximum possible width.

Example Program and Statement Details 181

Page 192: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

CAPSHAPE Specifies the shape at the ends of the whiskers.

CONNECT Specifies that a connect line joins a statisticfrom box to box.

CONNECTATTRS Specifies the properties of the line connectingmultiple boxes.

DATALABEL Specifies the labels of the outliers.

DATALABELATTRS Specifies the color and font attributes of theoutlier labels.

DATATRANSPARENCY Specifies the degree of the transparency of thebox outlines, box fill, whiskers, mean, median,caps, connect lines, and outliers, if displayed.

DISCRETEOFFSET Specifies an amount to offset all boxes from thediscrete X ticks.

DISPLAY Specifies the box plot features to display.

EXTREME Specifies whether the whiskers can extendbeyond the fences.

FILLATTRS Specifies the appearance of the interior fill areaof the boxes.

FREQ Specifies a numeric column that providesfrequencies for each observation read.

LABELFAR on page 187 Specifies whether all outliers or only far outliersare labeled.

LEGENDLABEL Specifies the label to be used in a legend.

MEANATTRS Specifies the attributes of the maker thatrepresents the mean values.

MEDIANATTRS Specifies the properties of the line thatrepresents the median values.

NAME Assigns a name to a plot statement for referencein other template statements.

ORIENT Specifies the orientation of the Y axis and of theboxes.

OUTLIERATTRS Specifies the attributes of the outlier makers.

OUTLINEATTRS Specifies the properties of the box outlines.

182 Chapter 18 • BOXPLOT Statement

Page 193: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

PERCENTILE Specifies one of five definitions used tocalculate percentiles.

PRIMARY Specifies that the data columns and plot type forthis plot be used for determining default axisfeatures.

SPREAD Specifies whether outliers with the same valueare spread out to avoid overlap.

WHISKERATTRS Specifies the line properties of the whiskers andcaps.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

BOXWIDTH=numberspecifies the width of a box as a ratio of the maximum possible width.

Default: .4

Range: 0 (narrowest) to 1 (widest)

CAPSHAPE=SERIF | LINE | BRACKETspecifies the shape at the ends of the whiskers.

Default: The GraphBox:CapStyle style reference.

SERIFspecifies a short line perpendicular to the whisker.

LINEspecifies a line perpendicular to whisker extending the width of the box.

BRACKETspecifies a line perpendicular to the whisker extending the width of the box withshort extensions at the ends drawn in the direction of the box.

Interaction: The cap color and the thickness are specified by theWHISKERATTRS= option. The cap pattern is always solid.

Interaction: The DISPLAY= option must include CAPS for cap lines to be shown.

CONNECT= MEAN | MEDIAN | Q1 | Q3 | MIN | MAXspecifies that a connect line joins a statistic from box to box.

Default: The GraphBox:Connect style reference.

Requirement: The DISPLAY= option must contain the CONNECT suboption for theconnect line to be displayed.

Interaction: This option only applies when the X= argument is used to generatemultiple boxes.

Example Program and Statement Details 183

Page 194: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

CONNECTATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the lines connecting multiple boxes. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphConnectLine style element.

Interaction: If there is only one box, this option is ignored.

DATALABEL=columnspecifies the labels of the outliers. Either a numeric or a character column can be used.

Default: no default

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

See also: LABELFAR= option

DATALABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the outlier labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphDataText style element.

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

Interaction: If one or more label options are specified and they do not include all thefont properties (color, family, size, weight, style), non-specified properties are derivedfrom the GraphDataText style element.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the box outlines, box fill, whiskers, mean,median, caps, connect lines, and outliers, if displayed.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent).

DISCRETEOFFSET=numberspecifies an amount to offset all boxes from the discrete X ticks.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

Default: 0 (no offset, all boxes are centered on the discrete ticks)

Range: -0.5 to +0.5, where .5 represents half the distance between discrete ticks. Apositive offset is to the right when ORIENT=VERTICAL, and up whenORIENT=HORIZONTAL. (If the layout's axis options set REVERSE=TRUE, thenthe offset direction is also reversed.)

Details: This feature is useful for graphing multiple response variables side by side ona common axis. By default within an overlay-type layout, if multiple BOXPLOTstatements are used with different analysis variables, the boxes for matching X valuesare centered on the ticks. Depending on the data, the boxes might be superimposed.The following code fragment shows the default box positioning:

layout overlay / cycleattrs=true yaxisopts=(label="Miles Per Gallon");

boxplot x=type y=mpg_city / name="City"; boxplot x=type y=mpg_highway / name="Highway";

184 Chapter 18 • BOXPLOT Statement

Page 195: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

discretelegend "City" "Highway";endlayout;

To place the different response values side by side, you can assign a different offset toeach BOXPLOT statement. The BOXWIDTH= option can be used in conjunction withthe DISCRETEOFFSET= option to create narrower boxes when desired.

layout overlay / cycleattrs=true yaxisopts=(label="Miles Per Gallon");

boxplot x=type y=mpg_city / name="City" discreteoffset=.2 ; boxplot x=type y=mpg_highway / name="Highway" discreteoffset=-.2 ;

discretelegend "City" "Highway";endlayout;

DISPLAY=STANDARD | ALL | ( display-options )specifies which additional features of the box plot to display.

Default: The GraphBox:DisplayOpts style reference. If this style element does notexist, the default is STANDARD.

STANDARDdisplays this combination of features (CAPS FILL MEAN MEDIAN OUTLIERS)

ALLdisplays all features

Example Program and Statement Details 185

Page 196: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

(display-options)a list of features, enclosed in parentheses, to be displayed. The list can include anyof the following:

CAPS displays caps at the ends of the whiskersCONNECT displays the line connecting multiple

boxesFILL displays filled boxesMEAN displays the mean symbol within the boxMEDIAN displays the median line within the boxNOTCHES displays notched boxesOUTLIERS displays markers for the outliers

Interaction: If EXTREME=TRUE, then the OUTLIERS feature is ignored

To control the appearance of these features, use the CONNECTATTRS=,FILLATTRS=, MEANATTRS=, MEDIANATTRS=, OUTLIERATTRS=, andWHISKERATTRS= options. The WHISKERATTRS= option controls affects bothCAPS and WHISKERS.

Details: The endpoints of the notches are at the following computed locations.

median ± 1.58 IQR / N

In the equation, the IQR (IQR=Q3-Q1) is the interquartile range and N is the samplesize.

EXTREME=booleanspecifies whether the whiskers can extend beyond the fences.

Default: FALSE

FALSEspecifies that whiskers be drawn from the upper edge of the box to the largest valuewithin the upper fence, and from the lower edge of the box to the smallest valuewithin the lower fence. This representation is sometime called a schematic box andwhisker plot or Tukey box and whisker plot.

TRUEspecifies that whiskers be drawn to the largest and smallest data values, whetherthese values are inside or outside the fences. The outliers and far outliers are notdisplayed and are not labeled. This representation is sometime called a skeletal boxand whisker plot.

186 Chapter 18 • BOXPLOT Statement

Page 197: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option overrides the DATALABEL=, DATALABELATTRS=,LABELFAR=, OUTLIERATTRS=, and SPREAD= options.

Fences are locations above and below the box. The upper and lower fences are locatedat a distance 1.5 times the Interquartile Range (IQR) ( IQR = Q3 - Q1 ). The upper andlower far fences are located at a distance 3 times the IQR (see “Example Program andStatement Details” on page 179).

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the interior fill area of the boxes. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “FillOptions” on page 564 for available fill-options.

Default: The GraphDataDefault style element.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

FREQ=numeric-column | expressionspecifies a numeric column that provides frequencies for each observation read. If n isthe value of the numeric-column for a given observation, then that observation is usedn times for any statistical computation.

Default: Each observation is counted once.

Restriction: If the value of the numeric-column is missing or is less than 1, theobservation is not used in the analysis. If the value is not an integer, only the integerportion is used.

LABELFAR=booleanspecifies whether all outliers or only far outliers are labeled. For more information aboutoutliers, see the “Example Program and Statement Details” on page 179.

Default: FALSE

FALSEthe labels specified by the DATALABEL= option apply to both outliers and faroutliers.

TRUEthe labels specified by the DATALABEL= option only apply to far outliers.

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

MEANATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the marker representing the mean within the box. See “GeneralSyntax for Attribute Options” on page 563 for the syntax on using a style-element and“Marker Options” on page 565 for available marker-options.

Default: The GraphBoxMean style element.

Interaction: This option is ignored if the DISPLAY= option does not display the mean.

MEDIANATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the line representing the median within the box. See“General Syntax for Attribute Options” on page 563 for the syntax on using a style-element and “Line Options” on page 564 for available line-options.

Default: The GraphBoxMedian style element.

Example Program and Statement Details 187

Page 198: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option is ignored if the DISPLAY= option does not display themedian.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

ORIENT= VERTICAL | HORIZONTALspecifies the orientation of the Y axis and of the boxes.

Default: VERTICAL

OUTLIERATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the markers representing the outliers. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “MarkerOptions” on page 565 for available marker-options.

Default: The GraphOutlier style element.

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the box outline. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default: The GraphOutlines style element.

PERCENTILE= 1 | 2 | 3 | 4 | 5specifies one of five definitions used to calculate percentiles.

Default: 5 (empirical distribution function with averaging)

The percentile definitions and default are the same as used by PCTLDEF= option ofPROC UNIVARIATE or the QNTLDEF= option of PROC SUMMARY.

Calculating Percentiles: You can specify one of five definitions for computing thepercentiles with the PERCENTILE= option. Let n be the number of nonmissing valuesfor a variable, and let X1, X2, ..., Xn represent the ordered values of the variable.X1 is the smallest value, X2 is the next smallest, and Xn is the largest value. Let the t

th percentile be y, set p = t100 , and let

np = j + g when PERCENTILE=1, 2, 3, or 5

(n + 1)p = j + g when PERCENTILE=4

where j is the integer part of np, and g is the fractional part of np. Then thePERCENTILE= option defines the tth percentile, y, as described in the following table:

188 Chapter 18 • BOXPLOT Statement

Page 199: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

SPREAD=booleanspecifies whether outliers with the same value are spread out to avoid overlap. Forvertical box plots this means offsetting the outliers horizontally. If this option is false,outliers with the same value are plotted in the same position. Thus, only one is visible

Default: FALSE

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

WHISKERATTRS=style-element | style-element (line-options) | (line-options)specifies the line properties of the whiskers and caps. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphBoxWhisker style element.

XAXIS=X | X2specifies whether data are mapped to the primary X (left) axis or to the secondary X2(right) axis.

Default: X

Interaction: This option is ignored if the X= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 189

Page 200: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (bottom) axis or to the secondaryY2 (top) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

190 Chapter 18 • BOXPLOT Statement

Page 201: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 19

BOXPLOTPARM Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193Input Data Requirements for the BOXPLOTPARM Statement . . . . . . . . . . . . . . . 194Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

Description and Syntax

Creates side-by-side box-and-whisker plots specified by parameters.

BOXPLOTPARM Y = numeric-column | expressionSTAT = string-column </option(s)>;

BOXPLOTPARM X = column | expressionY = numeric-column | expressionSTAT = string-column </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 192:

191

Page 202: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph boxplotparm1; begingraph; entrytitle "City Mileage for Vehicle Types"; layout overlay; boxplotparm y=value x=x stat=stat / datalabel=datalabel spread=true ; endlayout; endgraph; end;run; proc sgrender data=boxdata template=boxplotparm1;run;

The following input data generated the box for Sedan in the graph. See Appendix A4,“Computing Input Data for BOXPLOTPARM,” on page 573 to see the code for creatingall of the data.

STAT X VALUE DATALABEL ... N Sedan 262MEAN Sedan 21.0840MEDIAN Sedan 20 Q1 Sedan 18 Q3 Sedan 24 STD Sedan 4.2346OUTLIER Sedan 36 HondaOUTLIER Sedan 35 Toyota

192 Chapter 19 • BOXPLOTPARM Statement

Page 203: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OUTLIER Sedan 35 ToyotaOUTLIER Sedan 38 VolkswagenMIN Sedan 12 MAX Sedan 33 ...

Statement SummaryThe BOXPLOTPARM statement requires pre-computed input data. One reason to choosethis statement over the BOXPLOT statement is that you can control the computationaltechnique used to define the box plot components: the mean, quartiles, location of fences,outlier definition, and so on. See Appendix A4, “Computing Input Data forBOXPLOTPARM,” on page 573 for examples of such computations using PROCSUMMARY and DATA steps.

The BOXPLOTPARM statement displays a single box if given just Y and a STATargument. It displays multiple boxes if given both Y and X and a STAT argument and Xhas more than one unique value.

Two basic box plot representations can be drawn with the BOXPLOTPARM statement: aschematic (Tukey) box plot and a skeletal box plot. See the EXTREME= option for details.

The following figure illustrates the box plot elements:

As shown in the figure, the bottom and top edges of the box are located at the 1st quartile(25th percentile) and 3rd quartile (75th percentile) of the sample. Within the box you candisplay the median (50th percentile) as a line and the mean as a marker (see theDISPLAY= option).

You can also display markers and data labels for outliers. Outliers are observations that aremore extreme than the upper and lower fences ( ±1.5IQR ). Outliers that are beyond upperand lower far fences ( ±3IQR ) are called FAR OUTLIERS and can also be identified andlabeled. From a graphical perspective, the location of fences along the axis are known, but

Example Program and Statement Details 193

Page 204: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

there is no line or marker that displays a fence. (See DISPLAY=, LABELFAR=, andDATALABEL= options).

Finally, you can control the range represented by the whiskers. By default, the whiskersare drawn from the upper edge of the box to the MAX value, and from the lower edge ofthe box to the MIN value (see EXTREME= option).

Input Data Requirements for the BOXPLOTPARM StatementAt a minimum, valid data for the BOXPLOTPARM statement must provide a numericcolumn (Y=) that contains calculated statistics for an analysis, and a string column(STAT=) that identifies each statistic. The Y column must contain nonmissing values forthe Q1 (25th percentile) and Q3 (75th percentile) statistics. If Y values are missing or notsupplied for other statistic values, then those statistics are not displayed in the plot,regardless of syntax requests to display them.

For example, a petroleum company uses a turbine to heat water into steam that is pumpedinto the ground to make oil more viscous and easier to extract. This process occurs 20 timesdaily, and the amount of power (in kilowatts) used to heat the water to the desiredtemperature is recorded. The following data show the statistics that are calculated for oneday of this process:

PowerOutputs Statistic

3180.00 MIN

3340.00 Q1

3487.40 MEAN

3490.00 MEDIAN

3610.00 Q3

4050.00 MAX

20.00 N

To plot the data from the preceding table, the following BOXPLOTPARM statement usesthe Y= and STAT= arguments to generate a single box plot for the recorded statistics:

BOXPLOTPARM Y=PowerOutputs STAT=Statistic;

194 Chapter 19 • BOXPLOTPARM Statement

Page 205: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

If the data contain statistics for multiple days of the process, a third column in the data mustbe present to identify the days that the statistics were recorded. For example, the followingdata show the statistics that are calculated for two days of this process:

Day PowerOutputs Statistic

04JUL 3180.00 MIN

04JUL 3340.00 Q1

04JUL 3487.40 MEAN

04JUL 3490.00 MEDIAN

04JUL 3610.00 Q3

04JUL 4050.00 MAX

04JUL 20.00 N

05JUL 3179.00 MIN

05JUL 3333.50 Q1

05JUL 3471.65 MEAN

05JUL 3419.50 MEDIAN

05JUL 3605.00 Q3

05JUL 3849.00 MAX

05JUL 20.00 N

To plot the data from the preceding table, the BOXPLOTPARM statement needs the Y=,STAT=, and X= arguments to generate a separate box plot for each day that the statisticswere recorded:

Example Program and Statement Details 195

Page 206: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

BOXPLOTPARM Y=PowerOutputs STAT=Statistic X=Day;

See Appendix A4, “Computing Input Data for BOXPLOTPARM,” on page 573 for a morecomplete example of providing input data for BOXPLOTPARM.

ArgumentsY=numeric-column | expression

specifies the column for the Y values. The Y values must be the statistical values neededfor the box plot. At a minimum, there must be nonmissing values for the 25th and 75thpercentiles.

X=column | expressionspecifies the column for the X values. The X values must qualify or classify the valuesin the Y column. This optional argument is used to create a plot box for each classifier.

STAT=string-columnspecifies the statistic that is represented by the value in the Y column. Valid STAT=values include the following:

Q11st quartile (25th percentile). The data must contain a nonmissing value for thisquartile.

Q33rd quartile (75th percentile). The data must contain a nonmissing value for thisquartile.

MAXmaximum data value less than or equal to the upper fence.

MINminimum data value greater than or equal to the lower fence.

MEANdata mean.

MEDIANdata median.

196 Chapter 19 • BOXPLOTPARM Statement

Page 207: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OUTLIERan observation outside the lower and upper fences. The fences are located at adistance 1.5 times the Interquartile Range (IQR = Q3 - Q1) above and below thebox. The outliers are labeled when the DATALABEL= option is used.

FAROUTLIERan observation outside the lower and upper far fences. The far fences are located ata distance 3 times the Interquartile Range (IQR = Q3 - Q1) above and below thebox. The far outliers are labeled when the DATALABEL= option is used. Specifythat LABELFAR=TRUE to label only the far outliers but not the outliers.

Nsubgroup sample size. The N value is not shown in the plot but is used to calculatenotch locations when the DISPLAY= option displays notches.

STDdata standard deviation.

Requirement: Other STAT values can be omitted or have missing Y values, but ifpresent, must conform to the following rules for the plot to be displayed:

Q1 <= MEDIAN <= Q3MIN <= MAXSTD >= 0N > 0

Options

Statement Option Description

BOXWIDTH Specifies the width of a box as a ratio of themaximum possible width.

CAPSHAPE Specifies the shape at the ends of the whiskers.

CONNECT Specifies that a connect line joins a statisticfrom box to box.

CONNECTATTRS Specifies the properties of the line connectingmultiple boxes.

DATALABEL Specifies the labels of the outliers.

DATALABELATTRS Specifies the color and font attributes of theoutlier labels.

DATATRANSPARENCY Specifies the degree of the transparency of thebox outlines, box fill, whiskers, mean, median,caps, connect lines, and outliers, if displayed.

DISCRETEOFFSET Specifies an amount to offset all boxes from thediscrete X ticks.

DISPLAY Specifies the box plot features to display.

Example Program and Statement Details 197

Page 208: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

EXTREME Specifies whether the whiskers can extendbeyond the fences.

FILLATTRS Specifies the appearance of the interior fill areaof the boxes.

LABELFAR Specifies whether all outliers or only far outliersare labeled.

LEGENDLABEL Specifies the label to be used in a legend.

MEANATTRS Specifies the attributes of the maker thatrepresents the mean values.

MEDIANATTRS Specifies the properties of the line thatrepresents the median values.

NAME Assigns a name to a plot statement for referencein other template statements.

ORIENT Specifies the orientation of the Y axis and of theboxes.

OUTLIERATTRS Specifies the attributes of the outlier makers.

OUTLINEATTRS Specifies the line properties of the box outlines.

PRIMARY Specifies that the data columns and plot type forthis plot be used for determining default axisfeatures.

SPREAD Specifies whether outliers with the same valueare spread out to avoid overlap.

WHISKERATTRS Specifies the line properties of the whiskers andcaps.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

BOXWIDTH=numberspecifies the width of a box as a ratio of the maximum possible width.

Default: .4

Range: 0 (narrowest) to 1 (widest)

CAPSHAPE=SERIF | LINE | BRACKETspecifies the shape at the ends of the whiskers.

198 Chapter 19 • BOXPLOTPARM Statement

Page 209: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: The GraphBox:CapStyle style reference.

SERIFspecifies a short line perpendicular to the whisker.

LINEspecifies a line perpendicular to whisker extending the width of the box.

BRACKETspecifies a line perpendicular to the whisker extending the width of the box withshort extensions at the ends drawn in the direction of the box.

Interaction: The cap color and the thickness are specified by theWHISKERATTRS= option. The cap pattern is always solid.

Interaction: The DISPLAY= option must include CAPS for cap lines to be shown.

CONNECT= MEAN | MEDIAN | Q1 | Q3 | MIN | MAXspecifies that a connect line joins a statistic from box to box.

Default: The GraphBox:Connect style reference.

Requirement: The DISPLAY= option must contain the CONNECT suboption for theconnect line to be displayed.

Interaction: This option only applies when the X= argument is used to generatemultiple boxes.

CONNECTATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the lines connecting multiple boxes. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphConnectLine style element.

Interaction: If there is only one box, this option is ignored.

DATALABEL=columnspecifies the labels of the values that are identified as outlier or faroutlier by the STAT=column. Either a numeric or a character column can be used.

Default: no default

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

See also: LABELFAR= option

DATALABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the outlier labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphDataText style element.

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

Interaction: If one or more specified label options does not include all the fontproperties (color, family, size, weight, style), non-specified properties are derived fromthe GraphDataText style element.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the box outlines, box fill, whiskers, mean,median, caps, connect lines, and outliers, if displayed.

Default: 0

Example Program and Statement Details 199

Page 210: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Range: 0 (opaque) to 1 (entirely transparent).

DISCRETEOFFSET=numberspecifies an amount to offset all boxes from the discrete X ticks.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

Default: 0 (no offset, all boxes are centered on the discrete ticks)

Range: -0.5 to +0.5, where .5 represents half the distance between discrete ticks. Apositive offset is to the right when ORIENT=VERTICAL, and up whenORIENT=HORIZONTAL. (If the layout's axis options set REVERSE=TRUE, thenthe offset direction is also reversed.)

Details: This feature is useful for graphing multiple response variables side by side ona common axis. By default within an overlay-type layout, if multiple BOXPLOTPARMstatements are used with different analysis variables, the boxes for matching X valuesare centered on the ticks. Depending on the data, the boxes might be superimposed.The following code fragment shows the default box positioning:

layout overlay / cycleattrs=true yaxisopts=(label="Miles Per Gallon");

boxplotparm x=type y=mpg_city stat=y_stat / name="City" ; boxplotparm x=type y=mpg_highway stat=y_stat / name="Highway" ;

discretelegend "City" "Highway";endlayout;

To place the different response values side by side, you can assign a different offset toeach BOXPLOTPARM statement. The BOXWIDTH= option can be used inconjunction with the DISCRETEOFFSET= option to create narrower boxes whendesired.

layout overlay / cycleattrs=true yaxisopts=(label="Miles Per Gallon");

boxplotparm x=type y=mpg_city stat=y_stat / name="City" discreteoffset=.2 ; boxplotparm x=type y=mpg_highway stat=y_stat / name="Highway" discreteoffset=-.2 ;

discretelegend "City" "Highway";endlayout;

200 Chapter 19 • BOXPLOTPARM Statement

Page 211: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DISPLAY=STANDARD | ALL | ( display-options )specifies which additional features of the box plot to display.

Default: The GraphBox:DisplayOpts style reference. If this style element does notexist, the default is STANDARD.

STANDARDdisplays this combination of features (CAPS FILL MEAN MEDIAN OUTLIERS)

ALLdisplays all features

display-optionsa list of features to be displayed. The list must be enclosed in parentheses and caninclude any of the following:

CAPS displays caps at the ends of the whiskersCONNECT displays the line connecting multiple

boxesFILL displays filled boxesMEAN displays the mean symbol within the boxMEDIAN displays the median line within the boxNOTCHES displays notched boxesOUTLIERS displays markers for the outliers

Restriction: The display features requested can be displayed only if the input dataincludes this information.

Interaction: If EXTREME=TRUE, then the OUTLIERS feature is ignored

To control the appearance of these features, use the CONNECTATTRS=,FILLATTRS=, MEANATTRS=, MEDIANATTRS=, OUTLIERATTRS=, andWHISKERATTRS= options. The WHISKERATTRS= option controls affects bothCAPS and WHISKERS.

Details: The endpoints of the notches are at the following computed locations.

median + and − 1.58(IQR / N )

Example Program and Statement Details 201

Page 212: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

In the equation, the IQR is the interquartile range and N is the sample size.

EXTREME=booleanspecifies whether the whiskers can extend beyond the fences.

Default: FALSE

FALSEspecifies that whiskers be drawn from the upper edge of the box to the largest valuewithin the upper fence, and from the lower edge of the box to the smallest valuewithin the lower fence. This representation is sometime called a schematic box andwhisker plot or Tukey box and whisker plot.

TRUEspecifies that whiskers be drawn to the largest and smallest data values, whetherthese values are inside or outside the fences. The outliers and far outliers are notdisplayed and are not labeled. This representation is sometime called a skeletal boxand whisker plot.

Interaction: This option overrides the DATALABEL=, DATALABELATTRS=,LABELFAR=, OUTLIERATTRS=, and SPREAD= options.

Fences are locations above and below the box. The upper and lower fences are locatedat a distance 1.5 times the Interquartile Range (IQR) ( IQR = Q3 - Q1 ). The upper andlower far fences are located at a distance 3 times the IQR (see “Example Program andStatement Details” on page 191).

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the interior fill area of the boxes. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “FillOptions” on page 564 for available fill-options.

Default: The GraphDataDefault style element.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

LABELFAR=booleanspecifies whether all outliers or only far outliers are labeled. For more information aboutoutliers, see the “Example Program and Statement Details” on page 191.

Default: FALSE

FALSEthe labels specified by the DATALABEL= option apply to both outliers and faroutliers.

202 Chapter 19 • BOXPLOTPARM Statement

Page 213: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TRUEthe labels specified by the DATALABEL= option only apply to far outliers.

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

MEANATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the marker representing the mean within the box. See “GeneralSyntax for Attribute Options” on page 563 for the syntax on using a style-element and“Marker Options” on page 565 for available marker-options.

Default: The GraphBoxMean style element.

Interaction: This option is ignored if the DISPLAY= option does not display the mean.

MEDIANATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the line representing the median within the box. See“General Syntax for Attribute Options” on page 563 for the syntax on using a style-element and “Line Options” on page 564 for available line-options.

Default: The GraphBoxMedian style element.

Interaction: This option is ignored if the DISPLAY= option does not display themedian.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

ORIENT= VERTICAL | HORIZONTALspecifies the orientation of the Y axis and of the boxes.

Default: VERTICAL

OUTLIERATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the markers representing the outliers. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “MarkerOptions” on page 565 for available marker-options.

Default: The GraphOutlier style element.

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the appearance of the box outline. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default: The GraphOutlines style element.

Example Program and Statement Details 203

Page 214: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

SPREAD=booleanspecifies whether outliers with the same value are spread out to avoid overlap. Forvertical box plots this means offsetting the outliers horizontally. If this option is false,outliers with the same value are plotted in the same position. Thus, only one is visible

Default: FALSE

Interaction: This option is ignored if EXTREME=TRUE or the DISPLAY= optiondoes not display the outliers.

WHISKERATTRS=style-element | style-element (line-options) | (line-options)specifies the line properties of the whiskers and caps. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphBoxWhisker style element.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: This option is ignored if the X= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

204 Chapter 19 • BOXPLOTPARM Statement

Page 215: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 20

CONTOURPLOTPARMStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

Description and Syntax

Creates a contour plot representing a response variable evaluated over a grid of X and Yvalues.

CONTOURPLOTPARM X = numeric-column | expressionY = numeric-column | expressionZ = numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 206:

205

Page 216: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph contourplotparm; begingraph; entrytitle "Contour Plot of Height and Weight"; layout overlay / xaxisopts=(offsetmin=0 offsetmax=0 linearopts=(thresholdmin=0 thresholdmax=0)) yaxisopts=(offsetmin=0 offsetmax=0 linearopts=(viewmax=250 thresholdmin=0 thresholdmax=0 )); contourplotparm x=height y=weight z=density / contourtype=fill nhint=12 name="Contour" colormodel=twocolorramp; continuouslegend "Contour" / title="Density"; endlayout; endgraph; end;run;proc sgrender data=sashelp.gridded template=contourplotparm;run;

Statement SummaryA CONTOURPLOTPARM statement uses the CONTOURTYPE= option to specify thetype of contour plot to generate. Contour types that display fills or gradients but no contourlines can use only a CONTINUOUSLEGEND statement to represent the contour levelvalues in a legend. Contour types that display lines can use either aCONTINUOUSLEGEND or DISCRETELEGEND statement to identify contour levelvalues.

206 Chapter 20 • CONTOURPLOTPARM Statement

Page 217: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

By default, the CONTOURPLOTPARM statement assumes that the X-Y grid is complete.If the grid is not complete, then set the GRIDDED= option to FALSE so that the plotcalculates the values needed to complete into a grid with a bounding rectangle.

For filled or gradient contour types, small gaps might be visible between the axes and thebounding box of the contour data. To eliminate these gaps, set the axis options of theLAYOUT OVERLAY statement as follows:

XAXISOPTS=(OFFSETMIN=0 OFFSETMAX=0 LINEAROPTS=(THRESHOLDMIN=0 THRESHOLDMAX=0) )

YAXISOPTS=(OFFSETMIN=0 OFFSETMAX=0 LINEAROPTS=(THRESHOLDMIN=0 THRESHOLDMAX=0 ))

Contour plots do not support the tooltips that are enabled by the IMAGEMAP= option inthe ODS GRAPHICS statement.

Required ArgumentsX=numeric-column | expression

specifies the X coordinates for the grid.

Y=numeric-column | expressionspecifies the Y coordinates for the grid.

Z=numeric-column | expressionspecifies the contour response values.

Options

Statement Option Description

COLORMODEL Specifies a style element that is used todetermine the colors of filled or gradientcontours.

CONTOURTYPE Specifies how the contour is displayed.

GRIDDED Specifies whether the grid formed by the X andY values is complete.

LEGENDLABEL Specifies the label to be used in a discretelegend.

LINEATTRS Specifies the properties of the contour lines.

LINELABELATTRS Specifies the color and font attributes of thecontour line labels.

LINELABELBASELINE Specifies the alignment of the contour linelabels.

LINELABELFORMAT Specifies the format of the contour line labels.

LINELABELPOSITION Specifies the position of the contour line labels.

Example Program and Statement Details 207

Page 218: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

NAME Assigns a name to a plot statement for referencein other template statements.

NHINT Specifies the suggested number of contourlevels for the Z variable.

NLEVELS Specifies the actual number of contour levelsfor the Z variable.

PRIMARY Specifies that the data columns for this plot andthe plot type be used for determining defaultaxis features.

REVERSECOLORMODEL Specifies whether to reverse the gradientdefined by the COLORMODEL= on page208 option.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

COLORMODEL=style-elementspecifies a style element that is used to determine the colors of filled or gradientcontours.

Default: The ThreeColorRamp style element.

style-elementName of a style element. The style element can contain these style attributes:

STARTCOLOR Specifies a color for the smallest datavalue of the Z variable.

NEUTRALCOLOR Specifies a color for the midpoint of therange of the Z variable.

ENDCOLOR Specifies a color for the highest data valueof the Z variable.

Interaction: The REVERSECOLORMODEL= option can be used to reverse the startand end colors of the ramp assigned to the color model.

Interaction: The NEUTRALCOLOR attribute is not used for two-color ramps.

CONTOURTYPE= LINE | LABELEDLINE | FILL | GRADIENT | LINEFILL |LINEGRADIENT | LABELEDLINEFILL | LABELEDLINEGRADIENT

specifies how the contour is displayed.

208 Chapter 20 • CONTOURPLOTPARM Statement

Page 219: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: The GraphContour:DisplayOpts style reference.

LINEdisplays contour levels as unlabeled lines.

FILLdisplays the area between the contour levels as filled. Each contour interval is filledwith one color.

GRADIENTdisplays a smooth gradient of color to represent contour levels.

LINEFILLcombines the LINE and FILL types. Each contour interval is filled with one color.Displays contour levels as unlabeled lines.

LINEGRADIENTcombines the LINE and GRADIENT types. Displays contour levels as unlabeledlines.

LABELEDLINEadds labels to the LINE type, displaying contour levels as labeled lines.

LABELEDLINEFILLadds labels to the LINEFILL type. Each contour interval is filled with one color.Displays contour levels as lines with labels showing contour level values.

LABELEDLINEGRADIENTadds labels to the LINEGRADIENT type. Displays contour levels as lines withlabels showing contour level values.

Interaction: The fill colors of the types that enable FILL or GRADIENT are controlledby the COLORMODEL= option.

Interaction: The line properties of the types that enable LINE or LABELEDLINE arecontrolled by the LINEATTRS= option.

Interaction: The label properties of the types that enable LABELEDLINE arecontrolled by the LINELABELATTRS= and LINELABELBASELINE= options.

Interaction: If a DISCRETELEGEND statement is associated with the contour, thelegend is NOT displayed if CONTOURTYPE= is set to FILL or GRADIENT.

Interaction: If a CONTINUOUSLEGEND statement is associated with the contour,the legend is NOT displayed if CONTOURTYPE is set to LINE or LABELEDLINE.

GRIDDED=booleanspecifies whether the grid formed by the X and Y values is complete.

Example Program and Statement Details 209

Page 220: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: TRUE

If set to FALSE, then additional calculations are performed.

For information about the algorithm used to calculate the grid, see Barnes, Stanley L.,“Mesoscale Objective Map Analysis Using Weighted Time-Series Observations,”United States National Oceanic and Atmospheric Administration, EnvironmentalResearch Labs, Norman, OK, Technical Memorandum (NOAA TM ERLNSSL-62),March 1973.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The Z-variable label. If a label is not defined, the Z-variable name.

Restriction: This option applies only to an associated DISCRETELEGEND statement.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the contour lines. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default: The GraphDataDefault style element.

Interaction: This option is honored only if the CONTOURTYPE= displays lines.

LINELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the contour line labels. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: This option is honored only if the CONTOURTYPE= displays labels.

LINELABELBASELINE=HORIZONTAL | TANGENTspecifies the text alignment of the contour line labels. Each contour line has aprecomputed label point.

Default: HORIZONTAL

HORIZONTALspecifies that each label is parallel to the X-axis. The label intersects its contourline and is centered at the label point.

TANGENTspecifies that each label is drawn tangent to the contour line at the label point. Thisreduces intersection with the contour line and causes labels to be tilted at variousangles in relation to the X-axis.

Interaction: This option is honored only if the CONTOURTYPE= displays labels.

LINELABELFORMAT=formatspecifies the format to use for the contour line labels.

Default: The format associated with the Z variable or BEST6. if no format is assigned.

Interaction: This option is honored only if the CONTOURTYPE= displays labels.

LINELABELPOSITION=MIDDLE | BEGIN | ENDspecifies the position for the contour line labels.

Default: MIDDLE

Interaction: This option is honored only if the CONTOURTYPE= displays labels.

210 Chapter 20 • CONTOURPLOTPARM Statement

Page 221: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to indicate the colorsassociated with the Z values.

NHINT=integerspecifies the suggested number of contour levels for the Z variable.

Default: 7

The actual number of levels is adjusted to provide an appropriate number of levels forthe data.

Interaction: This option is ignored if NLEVELS= is specified.

NLEVELS=integerspecifies the actual number of contour levels for the Z variable.

Default: The number of levels is determined internally, using the NHINT= value.

Interaction: This option overrides the NHINT= option.

Interaction: This option is ignored if CONTOURTYPE=GRADIENT.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

REVERSECOLORMODEL=booleanspecifies whether to reverse the gradient (color ramp) defined by theCOLORMODEL= option.

Default: FALSE

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Example Program and Statement Details 211

Page 222: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

212 Chapter 20 • CONTOURPLOTPARM Statement

Page 223: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 21

DENSITYPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216Distribution Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

Description and Syntax

Creates a univariate probability density curve computed from input data.

DENSITYPLOT numeric-column | expression </ <distribution-option> </option(s)>>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 214:

213

Page 224: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramWhen used as a stand-alone plot or overlaid with other DENSITYPLOTs, the dependentaxis shows the computed density values.

proc template; define statgraph densityplot1; begingraph; entrytitle "Fitted Density Curves"; entrytitle "of Patient Weight"; entryfootnote halign=left "Framingham Heart Study"; layout overlay; densityplot weight / normal() lineattrs=graphfit name="n" legendlabel="Normal"; densityplot weight / kernel() lineattrs=graphfit2 name="k" legendlabel="Kernel"; discretelegend "n" "k"; endlayout; endgraph; end;run;proc sgrender data=sashelp.heart template=densityplot1; label weight="Patient Weight";run;

When one or more DENSITYPLOTs are overlaid on a HISTOGRAM, the dependent axisshows the statistic indicated by the HISTOGRAM’s SCALE= option. The area under eachdensity curve is equal to the area of the HISTOGRAM.

214 Chapter 21 • DENSITYPLOT Statement

Page 225: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

proc template; define statgraph densityplot2; begingraph; entrytitle "Patient Weight Distribution"; entrytitle "with Fitted Normal Curve"; entryfootnote halign=left "Framingham Heart Study"; layout overlay; histogram weight / primary=true scale=count; densityplot weight / normal() lineattrs=graphfit; endlayout; endgraph; end;run;proc sgrender data=sashelp.heart template=densityplot2; label weight="Patient Weight";run;

Statement SummaryA typical DENSITYPLOT statement specifies either the NORMAL or the KERNELdistribution option. If no distribution option is specified, NORMAL() is used. Thefollowing syntax explicitly shows the default case:

DENSITYPLOT numeric-column / NORMAL()

To specify a KERNEL distribution, use the following plot syntax:

DENSITYPLOT numeric-column / KERNEL()

If more than one distribution option is specified, then the last distribution option specifiedis used.

Example Program and Statement Details 215

Page 226: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Required Argumentsnumeric-column

specifies a numeric column of data values that are used to calculate the parameters forthe probability distribution.

expressionspecifies an expression that calculates values when those values are not stored in thedata.

Distribution OptionsKERNEL (C=number WEIGHT=NORMAL | QUADRATIC | TRIANGULARMAXPOINTS=number )

specifies a nonparametric kernel density estimate. The general form of the kerneldensity estimator is as follows.

In the equation, K0( ⋅ ) is the weight function, λ is the bandwidth, λ is the sample size,and xi is the ith observation. You can use the C= suboption to specify the bandwidthand the WEIGHT= suboption to specify the weight function K0( ⋅ ).

For more information, see the discussion of Kernel Density Estimates for theUNIVARIATE procedure in the Base SAS Procedures Guide , Volume 3.

C=specifies a positive number (0 < number <= 100) that represents the standardizedbandwidth.

Default: Calculated from the data as the bandwidth that minimizes the approximatemean integrated square error (MISE).

The value of λ, referred to as the bandwidth parameter, determines the degree ofsmoothness in the estimated density function. You specify λ indirectly byspecifying a standardized bandwidth c with the C= kernel-option. If Q is theinterquartile range and n is the sample size, then c is related to λ by the followingformula:

λ = cQn − 15

WEIGHT=specifies one of the weight functions NORMAL, QUADRATIC, orTRIANGULAR.

Default: NORMAL

The formulas for the weight functions are

216 Chapter 21 • DENSITYPLOT Statement

Page 227: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

MAXPOINTS=specifies the maximum number of points generated for the curve.

Default: 512

NORMAL ( MU=number SIGMA=number MAXPOINTS=number )specifies a normal density estimate, with mean and standard deviation. The fitteddensity function equation is as follows:

In the equation, μ is the mean and σ is the standard deviation (σ > 0). You can specifyμ with the MU= suboption and σ with the SIGMA= suboption. By default, ODSestimates μ with the sample mean and σ with the sample standard deviation.

For more information, see the discussion of Kernel Density Estimates for theUNIVARIATE procedure in the Base SAS Procedures Guide , Volume 3.

MU=specifies the mean. If not specified, it is calculated from the data.

SIGMA=specifies the standard deviation. If not specified, it is calculated from the data.

MAXPOINTS=specifies the maximum number of points generated for the curve.

Default: 200

Options

Statement Option Description

CURVELABEL Specifies a label for the density curve.

CURVELABELATTRS Specifies the color and font attributes of thedensity curve label.

CURVELABELLOCATION Specifies the location of the curve label relativeto the plot area.

CURVELABELPOSITION Specifies the position of the density curve labelrelative to the curve line.

DATATRANSPARENCY Specifies the degree of the transparency of thedensity curve.

Example Program and Statement Details 217

Page 228: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

FREQ Specifies a numeric column that providesfrequencies for each observation read.

LEGENDLABEL Specifies the label of the legend.

LINEATTRS Specifies the properties of the density curve.

NAME Assigns a name to a plot statement for referencein other template statements.

ORIENT Specifies the orientation of the Y axis.

PRIMARY Specifies that the data columns for this plot andthe plot type be used for determining defaultaxis features.

TIPFORMAT Specifies display formats for the tooltips thatare displayed when the cursor is positioned overthe density curve.

TIPLABEL Specifies display labels for the tooltips that aredisplayed when the cursor is positioned over thedensity curve.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CURVELABEL="string"specifies a label for the density curve.

Default: no default

The font and color attributes for the label are specified by the CURVELABELATTRS=option.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the density curve label. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: For this option to take effect, the CURVELABEL=curvelabel option mustalso be used.

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the density curve label relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

218 Chapter 21 • DENSITYPLOT Statement

Page 229: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the DENSITYPLOT is used in multi-celllayouts such as LATTICE, DATAPANEL, or DATALATTICE, where axes can beexternal to the grid.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the curve label appears. Formore information, see “Location and Position of Curve Labels” on page 123.

CURVELABELPOSITION=AUTO | MAX | MIN | START | ENDSpecifies the position of the density curve label relative to the curve line.

Default: AUTO when CURVELABELLOCATION=OUTSIDE. END whenCURVELABELLOCATION=INSIDE.

AUTOOnly used when CURVELABELPOSITION=OUTSIDE. The density label ispositioned automatically near the end of the density curve along unused axeswhenever possible (typically Y2 or X2) to avoid collision with tick values.

MAXForces the density label to appear near maximum density X- values (typically, tothe right).

MINForces the density label to appear near minimum density X- values (typically, tothe left).

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces density label toappear near the beginning of the curve. Particularly useful when the curve line hasa spiral shape.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces density label toappear near the end of the curve. Particularly useful when the curve line has a spiralshape.

Restriction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified. The START and END settings arenot supported if CURVELABELLOCATION=OUTSIDE is specified.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELLOCATION= option to determine where the density label appears.For more information, see “Location and Position of Curve Labels” on page 123.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the density curve.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

FREQ=numeric-column | expressionspecifies a numeric column that provides frequencies for each observation read. If n isthe value of the numeric-column for a given observation, then that observation is usedn times in computing the density curve.

Default: Each observation is counted once.

Example Program and Statement Details 219

Page 230: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: If the value of the numeric-column is missing or is less than 1, theobservation is not used in the analysis. If the value is not an integer, only the integerportion is used.

LEGENDLABEL= "string"specifies a label to be used in a legend.

Default: The string specified on the NAME= option.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the density curve. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default: The GraphFitLine style element.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

ORIENT=VERTICAL | HORIZONTALspecifies the orientation of the Y axis.

Default: VERTICAL

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

TIPFORMAT=(role-format-list)specifies display formats for the tooltips that are displayed when the cursor is positionedover the density curve.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of role-name = format pairs separated by blanks.

Use role-name X to format the tooltip values that map to the values along the Xaxis, and role-name Y to format the tooltip values that map to the values along theY axis.

TIPFORMAT=(Y=6.2)

220 Chapter 21 • DENSITYPLOT Statement

Page 231: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Tip: This option provides a way to control the formats of columns that appear intooltips.

TIPLABEL=(role-label-list)specifies display labels for the tooltips that are displayed when the cursor is positionedover the density curve.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of role-name = "string" pairs separated by blanks.

Use role-name X to label the tooltip values that map to the values along the X axis,and role-name Y to label the tooltip values that map to the values along the Y axis.

TIPLABEL=(Y="Normal Approximation")

Tip: This option provides a way to control the labels of columns that appear in tooltips.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

Example Program and Statement Details 221

Page 232: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

222 Chapter 21 • DENSITYPLOT Statement

Page 233: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 22

DROPLINE Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

Description and Syntax

Creates a horizontal or vertical drop line from a point to an axis.

DROPLINE X = x-axis-value | column | expressionY = y-axis-value | column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 224:

223

Page 234: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph dropline; begingraph; entrytitle "Drop lines at Inflection Point"; layout overlay / yaxisopts=(linearopts=(viewmin=0)); seriesplot x=x y=y; dropline x=3 y=5 / dropto=x lineattrs=(color=blue pattern=dot) label="(3,5)"; dropline x=3 y=5 / dropto=y lineattrs=(color=blue pattern=dot); endlayout; endgraph; end;run; data test; do X=0 to 8 by .25; Y=(x-3)*(x-3) + 5; output; end;run;

proc sgrender data=test template=dropline;run;

224 Chapter 22 • DROPLINE Statement

Page 235: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement SummaryA drop line is always drawn perpendicular from the specified point to the X (bottom), X2(top), Y (left), or Y2 (right) axis. Axis offsets do not apply to drop lines, so they alwaysmeet the axis line.

The DROPTO= option controls whether a horizontal or vertical drop line is created.DROPTO=X specifies the horizontal axis for a vertical drop line, and DROPTO=Yspecifies the vertical axis for a horizontal drop line.

A DROPLINE statement can be only used within a 2-D overlay-type layout (OVERLAY,OVERLAYEQUATED, PROTOTYPE). Another plot statement that is derived from datavalues that provide boundaries for the axis area must be included in the layout. For example,it can be used with a scatter plot or a histogram.

You can generate multiple drop lines by specifying a column for X and Y. The columntype (numeric or string) must agree with the type of data presented on the axis.

To generate both a vertical and a horizontal drop line from a single point, use multipleDROPLINE statements. For example, the graph in the figure illustrates two DROPLINEstatements originating from the same point (X=3, Y=5). One statement uses DROPTO=Xand the other uses DROPTO=Y.

Required ArgumentsX=x-axis-value | column | expression

specifies the X coordinate of the drop line(s).

Requirement: Values must agree in type with the X-axis data type. For example, youshould use numeric SAS date or time values (or SAS date/time constants) for a timeaxis.

By default, if a specified value is outside of the X-axis data range, then the data rangeis extended to include the value. This behavior can be changed with the CLIP= option.

Y=y-axis-value | column | expressionspecifies the Y coordinate of the drop line(s).

Requirement: Values must agree in type with the Y-axis data type.

By default, if a specified value is outside of the Y-axis data range, then the data rangeis extended to include the value. This behavior can be changed with the CLIP= option.

Options

Statement Option Description

CLIP Specifies whether the data for the drop line(s)are considered when determining the dataranges for the axes.

DATATRANSPARENCY Specifies the degree of the transparency of thedrop line(s).

DISCRETEOFFSET Specifies an amount to offset all drop lines fromdiscrete X values, or discrete Y values, or both.

Example Program and Statement Details 225

Page 236: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

DROPTO Specifies the axis to which the line is dropped.

LABEL Specifies a label for the point(s) indicated byX= and Y= options.

LABELATTRS Specifies the color and font attributes of thedrop line label.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the properties of the drop line(s).

NAME Assigns a name to a plot statement for referencein other template statements.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CLIP=booleanspecifies whether the data for the line are considered when determining the data rangesfor the axes.

Default: FALSE

FALSEThe data for the line contribute to the data range for each axis. Each axis might beextended to force the display of the line.

TRUEThe data for the line are ignored when establishing axis scales. Each axis scale isdetermined by the other plots in the parent layout. This might result in the line notbeing displayed if its data range is not within the data ranges of the other plots.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the drop line.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISCRETEOFFSET= numberspecifies an amount to offset all drop lines from the X values for a discrete X axis, orfrom the Y values for a discrete Y axis.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

Default: 0 (no offset, all drop lines are centered on X values for a discrete X axis, orY values for a discrete Y axis)

Range: -0.5 to +0.5 where .5 represents half the distance between discrete ticks. If theX axis is discrete, a positive offset is to the right. If the Y axis is discrete, a positiveoffset is up. If REVERSE=TRUE on the X or Y axis, then the offset direction is alsoreversed.

226 Chapter 22 • DROPLINE Statement

Page 237: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DROPTO=X | Yspecifies the axis to which the line is dropped.

Default: X

XDraws dropline(s) to an X axis. The XAXIS== option determines whether the X orX2 axis is the endpoint for the line.

YDraws dropline(s) to a Y axis. The YAXIS== option determines whether the Y orY2 axis is the endpoint for the line.

LABEL="string" | columnspecifies a label for the point(s) indicated by the X= and Y= arguments.

Default: no default

Interaction: If drawing multiple droplines using X=column or Y=column, you canassign corresponding labels by using a column to define the labels.

The font and color attributes for the label are specified by the LABELATTRS= option.

LABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the drop line label(s). See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: For this option to have any effect, the LABEL= option must also bespecified.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the drop line. See “General Syntax for Attribute Options” onpage 563 for the syntax on using a style-element and “Line Options” on page 564 foravailable line-options.

Default: The GraphReference style element.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Restriction: Another plot that establishes a data range for the designed axis must beincluded.

Example Program and Statement Details 227

Page 238: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Restriction: Another plot that establishes a data range for the designed axis must beincluded.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

228 Chapter 22 • DROPLINE Statement

Page 239: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 23

ELLIPSE Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231Confidence and Prediction Ellipses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

Description and SyntaxCreates a confidence ellipse computed from input data.

ELLIPSE X = numeric-column | expressionY = numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 230:

229

Page 240: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThis example overlays two ELLIPSE statements on a SCATTERPLOT of the same data.

• Both ELLIPSE statements use TYPE=PREDICTED.

• One ELLIPSE statement uses ALPHA=.2 and the other uses ALPHA=.05.

proc template; define statgraph ellipse; begingraph; entrytitle "Prediction Ellipses"; layout overlayequated / equatetype=equate; scatterplot x=petallength y=petalwidth / datatransparency=.5; ellipse x=petallength y=petalwidth / type=predicted alpha=.2 name="p80" legendlabel="80%" outlineattrs=graphconfidence; ellipse x=petallength y=petalwidth / type=predicted alpha=.05 name="p95" legendlabel="95%" outlineattrs=graphconfidence2; discretelegend "p80" "p95" / location=inside autoalign=(topleft); endlayout; entryfootnote halign=left "Fisher's Iris Data"; endgraph; end;run;proc sgrender data=sashelp.iris template=ellipse; run;

230 Chapter 23 • ELLIPSE Statement

Page 241: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement SummaryThe ELLIPSE statement can be used only within 2-D overlay-type layouts. It computes anellipse for a set of points specified by the X and Y columns and a confidence level specifiedby the ALPHA= option. Use the TYPE= option to control whether a predicted or confidenceellipse is generated.

Confidence and Prediction EllipsesTwo types of ellipses can be computed for the input data (where observations correspondto points in a scatter plot). One is a confidence ellipse for the population mean(TYPE=MEAN), and the other is a prediction ellipse for a new observation(TYPE=PREDICT). Both assume a bivariate normal distribution.

Let Z̄ and S be the sample mean and sample covariance matrix of a random sample of sizen from a bivariate normal distribution with mean μ and covariance matrix Σ. The variable

Z̄ − μ is distributed as a bivariate normal variate with mean zero and covariance ( 1n )Σ,

and it is independent of S . Using Hotelling’s T 2 statistic, which is defined as

T 2 = n(Z̄ − μ) ′ S −1(Z̄ − μ)

a 100(1 − α) % confidence ellipse for μ is computed from the equation

nn − 1 (Z̄ − μ) ′ S −1(Z̄ − μ) = 2

n − 2 F2,n−2(1 − α)

where F2,n−2(1 − α) is the (1 − α) critical value of an F distribution with degrees offreedom 2 and n − 2.

A prediction ellipse is a region for predicting a new observation in the population. It alsoapproximates a region containing a specified percentage of the population.

Denote a new observation as the bivariate random variable Znew. The variable

Znew − Z̄ = (Znew − μ) − (Z̄ − μ)

is distributed as a bivariate normal variate with mean zero (the zero vector) and covariance

(1 + 1n )Σ, and it is independent of S . A 100(1 − α) % prediction ellipse is then given by

the equation

nn − 1 (Z̄ − μ) ′ S −1(Z̄ − μ) = 2(n + 1)

n − 2 F2,n−2(1 − α)

The family of ellipses generated by different critical values of the F distribution has acommon center (the sample mean) and common major and minor axis directions.

The shape of an ellipse depends on the aspect ratio of the plot. The ellipse indicates thecorrelation between the two variables if the variables are standardized (by dividing thevariables by their respective standard deviations). In this situation, the ratio between themajor and minor axis lengths is

1 + | r |1 − | r |

Example Program and Statement Details 231

Page 242: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

In particular, if r = 0, the ratio is 1, which corresponds to a circular confidence contour andindicates that the variables are uncorrelated. A larger value of the ratio indicates a largerpositive or negative correlation between the variables.

Required ArgumentsX=numeric-column | expression

specifies the numeric column for the X values.

Y=numeric-column | expressionspecifies the numeric column for the Y values.

Options

Statement Option Description

ALPHA Sets a significance value for the confidencelevel to compute for the ellipse.

CLIP Specifies whether the data for the ellipse areconsidered when determining the data rangesfor the axes.

DATATRANSPARENCY Specifies the degree of the transparency of theellipse fill color and outline.

DISPLAY Specifies whether to display an outlined ellipse,a filled ellipse, or an outlined and filled ellipse.

FILLATTRS Specifies the appearance of the interior fill ofthe ellipse.

FREQ Specifies a numeric column that providesfrequencies for each observation read.

LEGENDLABEL Specifies the legend label.

NAME Assigns a name to a plot statement for referencein other template statements.

OUTLINEATTRS Specifies the properties of the ellipse outline.

TYPE Specifies the type of ellipse.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

ALPHA=positive-numbersets a significance value for the confidence level to compute for the ellipse.

232 Chapter 23 • ELLIPSE Statement

Page 243: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: .05

Range: 0 < number < 1

ALPHA=.05 represents a 95% confidence level.

See also: TYPE= option

CLIP=booleanspecifies whether the data for the ellipse are considered when determining the dataranges for the axes.

Default: FALSE

FALSEThe data for the ellipse contribute to the data range for each axis. Each axis mightbe extended to force the display of the entire ellipse.

TRUEThe data for the ellipse are ignored when establishing axis scales. Each axis scaleis determined by the other plots in the parent layout. This might result in the ellipsenot being entirely displayed (clipped) if its data range is not within the data rangesof the other plots.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the ellipse fill color and outline.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | ( display-options )specifies whether to display an outlined ellipse, a filled ellipse, or an outlined and filledellipse.

Default: GraphEllipse:DisplayOpts style reference.

STANDARDdisplays an outlined, unfilled ellipse

ALLdisplays an outlined, filled ellipse

(display-options)a list of features to be displayed. The list must be enclosed in parentheses and mustinclude one of the following:

OUTLINE—displays an outlined ellipse

FILL—displays a filled ellipse

Use FILLATTRS= and OUTLINEATTRS= to control the appearance of the ellipse.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the interior fill area of the ellipse. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “FillOptions” on page 564 for available fill-options.

Default: The GraphDataDefault style element.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

FREQ=numeric-column | expressionSpecifies a numeric column that provides frequencies for each observation read. If nis the value of the FREQ variable for a given observation, then that observation iscounted n times in computing the ellipse.

Example Program and Statement Details 233

Page 244: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: Each observation is counted once.

Restriction: If the value of the numeric-column is missing or is less than 1, theobservation is not used in the analysis. If the value is not an integer, only the integerportion is used.

LEGENDLABEL= "string"specifies the legend label.

Default: The string specified on the NAME= option.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the ellipse outline. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default: The GraphDataDefault style element.

Interaction: For this option to have any effect, the outlines must be enabled by theODS style or the DISPLAY= option.

TYPE=MEAN | PREDICTEDspecifies the type of ellipse.

Default: MEAN

MEANspecifies a confidence ellipse of the mean

PREDICTEDspecifies a prediction ellipse for a new observation

See also: ALPHA= option for specifying a confidence level.

See also: For statistical details about how the ellipse is calculated, see “Confidence andPrediction Ellipses ” on page 231.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

234 Chapter 23 • ELLIPSE Statement

Page 245: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 235

Page 246: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

236 Chapter 23 • ELLIPSE Statement

Page 247: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 24

ELLIPSEPARM Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241

Description and SyntaxCreates an ellipse specified by slope, axis, and origin parameters.

ELLIPSEPARM SEMIMAJOR = number | numeric-column | expressionSEMIMINOR = number | numeric-column | expressionSLOPE = number | numeric-column | expressionXORIGIN = number | numeric-column | expressionYORIGIN = number | numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 238:

237

Page 248: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThis is a simplified version of the CorrLoadPlot template for PROC PLS in theSAS/STAT product. It consists of overlaid scatter plots of the scores of the first two factors,the loadings of the model effects, and the loadings of the dependent variables. The loadingsare scaled so that the amount of variation in the variables that is explained by the model isproportional to the distance from the origin; circles indicating various levels of explainedvariation are also overlaid.

The circles are drawn with ELLIPSEPARM statements by setting the SEMIMAJOR andSEMIMINOR lengths to be the same. Notice that all circles are concentric because theyshare the same origin (0,0). The radius of each circle is passed dynamically.

Also note that an OVERLAYEQUATED layout was used to force the length of unitintervals on both axes to be the same.

The input data shown is representative of that computed by PROC PLS for the CorrelationLoadings Plot. For more details, see the first example for PROC PLS in the MISSINGBookref .

proc template; define statgraph ellipseparm; dynamic RADIUS1 RADIUS2 RADIUS3 RADIUS4 ; begingraph; entrytitle "Correlation Loading Plot"; layout overlayequated / equatetype=square commonaxisopts= (tickvaluelist=(-1 -.75 -.5 -.25 0 .25 .5 .75 1) viewmin=-1 viewmax=1) xaxisopts= (label="Factor 1" offsetmin=0.05 offsetmax=0.05) yaxisopts= (label="Factor 2" offsetmin=0.05 offsetmax=0.05);

238 Chapter 24 • ELLIPSEPARM Statement

Page 249: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ellipseparm semimajor=RADIUS1 semiminor=RADIUS1 slope=0 xorigin=0 yorigin=0 / clip=true display=(outline) outlineattrs=(pattern=dash) datatransparency=.75; ellipseparm semimajor=RADIUS2 semiminor=RADIUS2 slope=0 xorigin=0 yorigin=0 / clip=true display=(outline) outlineattrs=(pattern=dash) datatransparency=.75; ellipseparm semimajor=RADIUS3 semiminor=RADIUS3 slope=0 xorigin=0 yorigin=0 / clip=true display=(outline) outlineattrs=(pattern=dash) datatransparency=.75; ellipseparm semimajor=RADIUS4 semiminor=RADIUS4 slope=0 xorigin=0 yorigin=0 / clip=true display=(outline) outlineattrs=(pattern=dash) datatransparency=.75;

scatterplot x=xcirclelabel y=ycirclelabel / primary=true markercharacter=circlelabel datatransparency=0.75 ; scatterplot x=corr1 y=corr2 / name="ScatterVars" group=corrgroup markercharacter=corrlabel; discretelegend "ScatterVars"; endlayout; endGraph; end;run;

data corrplot; infile cards missover; input Corr1 Corr2 CorrGroup &$18. CorrLabel :$7. xCircleLabel yCircleLabel CircleLabel :$8.;datalines;-0.179 -0.268 Predictor Loading S1 0 0.5 25% 0.105 0.332 Predictor Loading S2 0 -0.5 25%-0.654 0.094 Predictor Loading S3 0 0.707 50%-0.653 0.685 Predictor Loading S4 0 -0.707 50% 0.096 0.059 Predictor Loading S5 0 0.866 75% 0.132 0.036 Predictor Loading L1 0 -0.866 75% 0.087 0.156 Predictor Loading L2 0 1 100% 0.940 0.160 Predictor Loading L3 0 -1 100% 0.607 -0.350 Predictor Loading L4 0.096 0.059 Predictor Loading L5-0.111 -0.534 Predictor Loading P1 0.003 0.256 Predictor Loading P2 0.293 0.551 Predictor Loading P3-0.480 0.643 Predictor Loading P4-0.096 -0.059 Predictor Loading P5 0.946 0.279 Response Loading log_RAI-0.196 0.403 Observation 1 0.020 -0.001 Observation 2-0.195 0.324 Observation 3 0.021 -0.079 Observation 4-0.009 -0.274 Observation 5 0.567 0.294 Observation 6-0.096 -0.059 Observation 7 0.258 0.210 Observation 8-0.104 -0.309 Observation 9-0.187 -0.458 Observation 10 0.051 -0.078 Observation 11 0.017 -0.260 Observation 12

Example Program and Statement Details 239

Page 250: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

-0.621 0.372 Observation 13 0.392 0.138 Observation 14 0.080 -0.221 Observation 15run;

proc sgrender data=corrplot template=ellipseparm; dynamic radius1=.50 radius2=.71 radius3=.87 radius4=1;run;

Statement SummaryThe ELLIPSEPARM statement plots an ellipse with specified semimajor and semiminoraxis lengths, a specified slope for the major axis, and the ellipse center. The ellipse centeris the point of intersection of the semimajor and semiminor axes.

An ELLIPSEPARM plot does not perform computations on input data to derive the locationand shape of the ellipse. See “ELLIPSE Statement” on page 229 for information aboutcomputed ellipses.

An ELLIPSEPARM statement can be used only within a 2-D overlay-type layout (forexample, an OVERLAY, OVERLAYEQUATED, or PROTOTYPE layout). Another plotthat is derived from data values that provide boundaries for the axis area must be includedin the layout. It is typically overlaid with a scatter plot.

You can generate a single ellipse by specifying a constant for each required argument. Youcan generate multiple ellipses by specifying a numeric column for any or all requiredarguments. If any of the SEMIMAJOR=, SEMIMINOR=, XORIGIN= or YORIGIN=constants or columns contains a missing value, no ellipse is drawn. To request a verticalmajor axis, specify SLOPE=. ( missing value as a constant or column value).

If the GROUP= option is specified, then the group value must be a column (character ornumeric). For each group value, there must be a numeric column value that does not containmissing values for SEMIMAJOR=, SEMIMINOR=, XORIGIN=, and YORIGIN=. TheSLOPE= column might contain missing values. Under these circumstances, one or moreellipse might be drawn for each group value.

Required ArgumentsSEMIMAJOR=number | numeric-column | expression

specifies half the length of the major axis for the ellipse.

Requirement: The SEMIMAJOR value must be positive.

Values are in the units of the data. The SEMIMAJOR value can be greater than, smallerthan, or equal to the SEMIMINOR value.

Interaction: If a numeric column is specified and the column contains missing ornegative values, no ellipse is drawn.

SEMIMINOR=number | numeric-column | expressionspecifies half the length of the minor axis for the ellipse.

Requirement: The SEMIMINOR value must be positive.

Values are in the units of the data. The SEMIMINOR value can be greater than, smallerthan, or equal to the SEMIMAJOR value.

Interaction: If a numeric column is specified and the column contains missing ornegative values, no ellipse is drawn.

240 Chapter 24 • ELLIPSEPARM Statement

Page 251: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

SLOPE=number | numeric-column | expressionspecifies the slope of the major axis for the ellipse.

Slope can be positive or negative.

Setting SLOPE=0 creates a major axis parallel to the X-axis. Setting SLOPE=. (missingvalue) creates a major axis parallel to the Y-axis.

The slope value is in the data space and might or might not be maintained in the screenspace. Thus, setting SLOPE=1 does not always generate a 45 degree line on the screen.

XORIGIN=number | numeric-column | expressionspecifies the X coordinate of the center of the ellipse.

Values are in the units of the data.

By default, if the value specified for the XORIGIN= option is outside of the X-axisdata range, then the data range is extended to include the specified point. This behaviorcan be changed with the CLIP= option.

YORIGIN=number | numeric-column | expressionspecifies the Y coordinate of the center of the ellipse.

Values are in the units of the data.

By default, if the value specified for the YORIGIN= option is outside of the Y-axisdata range, then the data range is extended to include the specified point. This behaviorcan be changed with the CLIP= option.

Options

Statement Option Description

CLIP Specifies whether the data for the ellipse areconsidered when determining the data rangesfor the axes.

DATATRANSPARENCY Specifies the degree of the transparency of theellipse fill color and outline.

DISPLAY Specifies whether to display an outlined ellipse,a filled ellipse, or an outlined and filled ellipse.

FILLATTRS Specifies the appearance of the interior fill ofthe ellipse.

GROUP Creates a separate ellipse for each unique groupvalue of the specified column.

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies a label for use in a legend.

NAME Assigns a name to a plot statement so that it canbe referenced in other template statements.

Example Program and Statement Details 241

Page 252: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

OUTLINEATTRS Specifies the properties of the ellipse outline.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CLIP=booleanspecifies whether the data for the ellipse are considered when determining the dataranges for the axes.

Default: FALSE

FALSEThe data for the ellipse contribute to the data range for each axis. Each axis mightbe extended to force the display of the entire ellipse.

TRUEThe data for the ellipse are ignored when establishing axis scales. Each axis scaleis determined by the other plots in the parent layout. This might result in the ellipsenot being entirely displayed (clipped) if its data range is not within the data rangesof the other plots.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the ellipse fill color and outline.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | ( display-options )specifies whether to display an outlined ellipse, a filled ellipse, or an outlined and filledellipse.

Default: GraphEllipse:DisplayOpts style reference.

STANDARDdisplays an outlined, unfilled ellipse

ALLdisplays an outlined, filled ellipse

(display-options)a list of features to be displayed. The list must be enclosed in parentheses and mustinclude one of the following:

OUTLINE—displays an outlined ellipse

FILL—displays a filled ellipse

Use FILLATTRS= and OUTLINEATTRS= to control the appearance of the ellipse.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the interior fill area of the ellipse. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “FillOptions” on page 564 for available fill-options.

Default:

242 Chapter 24 • ELLIPSEPARM Statement

Page 253: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the GraphData1 - GraphDataN style elements.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

GROUP=column | expressioncreates a separate ellipse for each unique group value of the specified column.

Default:

• If DISPLAY=(OUTLINE), each distinct group value might be represented in thegraph by a different combination of outline color and line pattern. Line color andpattern vary according to the ContrastColor and LineStyle attributes of theGraphData1 - GraphDataN style elements. Line thickness (for grouped andungrouped data) is controlled by the OUTLINEATTRS= option.

• If DISPLAY=(FILL), each distinct group value might be represented in the graphby a different fill color defined by the GraphData1:Color - GraphDataN:Color stylereferences.

• If DISPLAY=(FILL OUTLINE), each distinct group value might be representedin the graph by a different fill color, outline color, and outline pattern.

The representations that are used to identify the groups can be overridden individually.For example, each distinct group value might be represented by a different line patternfor the ellipses, but the PATTERN= suboption of the OUTLINEATTRS= option couldbe used to assign the same line pattern to all ellipse outlines, letting outline colordistinguish group values.

Restriction: This option can be used only when a numeric column is specified for theSLOPE=, SEMIMAJOR=, and SEMIMINOR= arguments.

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) and fill attributes to oneof the GraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to have any effect, the GROUP= option must also bespecified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style element touse.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

Interaction: If the GROUP= option is specified, this option is ignored.

Example Program and Statement Details 243

Page 254: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the ellipse outline. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the GraphData1 - GraphDataN style elements.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Restriction: Another plot that establishes a data range for the designed axis must beincluded.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Restriction: Another plot that establishes a data range for the designed axis must beincluded.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

244 Chapter 24 • ELLIPSEPARM Statement

Page 255: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 25

FRINGEPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

Description and Syntax

Creates a fringe plot on the X axis of an X-Y plot.

FRINGEPLOT numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 246:

245

Page 256: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph fringeplot; dynamic VAR VARLABEL; begingraph; entrytitle "Histogram and Fringeplot"; layout overlay / xaxisopts=(label=VARLABEL) yaxisopts=(offsetmin=.03); fringeplot VAR / datatransparency=.75 fringeheight=3pct; histogram VAR; endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=fringeplot; dynamic var="weight" varlabel="Weight (LBS)";run;

Statement SummaryIn a FRINGEPLOT, each fringe line represents the location of the corresponding raw datavalue on the X axis. All fringe lines are of equal length.

246 Chapter 25 • FRINGEPLOT Statement

Page 257: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Required Argumentsnumeric-column

specifies a column that contains numeric values that provide the X coordinates of thedata values.

expressionspecifies an expression that calculates values when those values are not stored in thedata.

Options

Statement Option Description

DATATRANSPARENCY Specifies the degree of the transparency of thefringe.

FRINGEHEIGHT Specifies the height of the fringe lines.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the properties of the fringe lines.

NAME Assigns a name to a plot statement for referencein other template statements.

ROLENAME Specifies roles for information defined by datacolumns.

TIP Specifies the information to display when thecursor is positioned over a fringe line.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the fringe.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

FRINGEHEIGHT=dimensionspecifies the height of the fringe lines.

Default: 10 px

Example Program and Statement Details 247

Page 258: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The X-variable label. If a label is not defined, the X-variable name.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the fringe lines for the data points. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphDataDefault style element.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

ROLENAME=( role-name-list )specifies user-defined roles for information contained in data columns.

Default: no default

role-name-lista blank-separated list of rolename = column pairs.

For example, ROLENAME= ( TIP1=PCT ) assigns the column PCT to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X and GROUP (reserved for future use).

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

TIP=(role-list)specifies the information to display when the cursor is positioned over a fringe line. Ifthis option is used, it replaces all the information displayed by default. Roles forcolumns that do not contribute to the fringe plot can be specified along with roles thatdo.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X and GROUP (reserved for future use).

role-listan ordered, blank-separated list of unique FRINGEPLOT and user-defined roles.The FRINGEPLOT role is X and GROUP.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles Xand Y, as well as the column PCT, which is not assigned to any pre-definedFringePlot role. The PCT column should appear first in the tooltip.

ROLENAME=(TIP1=PCT) TIP=(X TIP1)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

248 Chapter 25 • FRINGEPLOT Statement

Page 259: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

role-format-lista list of rolename = format pairs separated by blanks.

ROLENAME=(TIP1=PCT) TIP=(X TIP1) TIPFORMAT=( TIP1= PERCENT7.2 )

Requirement: This option provides a way to control the formats of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

TIPLABEL=(role-format-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

role-label-lista list of rolename = "string" pairs separated by blanks.

ROLENAME=(TIP1=PCT) TIP=(X TIP1) TIPLABEL=( TIP1="Percent" )

Requirement: This option provides a way to control the labels of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

The display of the fringe lines is always anchored on the X-axis (at the bottom of theplot area), even when the FRINGEPLOT’s X-variable data range is mapped to the X2axis.

Example Program and Statement Details 249

Page 260: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

250 Chapter 25 • FRINGEPLOT Statement

Page 261: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 26

HISTOGRAM Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

Description and SyntaxCreates a univariate histogram computed from input data.

HISTOGRAM numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 252:

251

Page 262: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph histogram; begingraph; entrytitle "Histogram of Vehicle Weights"; layout overlay / xaxisopts=(label="Vehicle Weight (LBS)") yaxisopts=(griddisplay=on); histogram weight; endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=histogram;run;

Statement SummaryThe Histogram’s default bin width is computed by using the number of observations andthe range of the data. When a curve is overlaid on the histogram, the histogram’s bin widthis used to scale the curve so that the area under the curve is equal to the area of the histogram.

Required Argumentsnumeric-column

specifies a variable that contains numeric values, or a dynamic variable that refers tosuch a variable.

252 Chapter 26 • HISTOGRAM Statement

Page 263: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

expressionspecifies an expression that calculates values when those values are not stored in thedata.

Options

Statement Option Description

BINAXIS Specifies whether to use bins as the basis for Xaxis tick marks.

BINSTART Specifies the X coordinate of the first bin.

BINWIDTH Specifies the bin width.

BOUNDARY Specifies how a boundary is counted when itlies on the endpoint of a bin.

DATATRANSPARENCY Specifies the degree of the transparency of thebars.

DISPLAY Specifies whether to display outlined bars,filled bars, or outlined and filled bars.

ENDLABELS Specifies whether axis ticks and value labels aredrawn at the endpoints of the bins or themidpoints of the bins.

FILLATTRS Specifies the appearance of the interior fill areaof the bars.

FREQ Specifies a column that indicates a frequencycount for each observation of the input dataobject.

LEGENDLABEL Specifies a label for use in a legend.

NAME Assigns a name to a plot statement for referencein other template statements.

NBINS Specifies the number of bins.

ORIENT Specifies the orientation of the Y axis and thebars.

OUTLINEATTRS Specifies the line properties of the bar outlines.

PRIMARY Specifies that the data columns for this plot beused for determining default axis features.

SCALE Specifies whether the Y axis displays thepercentages between 0 and 100, the frequencycounts, or the proportions between 0 and 1.

Example Program and Statement Details 253

Page 264: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

TIPFORMAT Specifies display formats for tip columns.

TIPLABEL Specifies display labels for information definedby roles.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

XVALUES Specifies whether the X values represent lowerendpoints, midpoints, or upper endpoints of thebins.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

BINAXIS=booleanSpecifies whether to use bins as the basis for axis tick marks.

Default: TRUE

FALSEThe ENDLABELS= option is ignored. A standard axis is used, ignoring binboundaries and midpoints.

TRUEThe ENDLABELS= option determines how the axis ticks and value labels aredisplayed. The axis ticks are in predetermined locations and cannot be changed withaxis suboptions such TICKVALUELIST= and TICKVALUESEQUENCE=.

Interaction: When this option is set to TRUE, some X-axis options that are set on theparent layout might not apply.

Interaction: This option is ignored if this HISTOGRAM is not the primary plot (formore information about primary plots, see “When Plots Share Data and a CommonAxis” on page 397).

BINSTART=numberspecifies the X coordinate of the first bin. Use this option in conjunction with theBINWIDTH= or NBINS= options to specify bins. If neither BINWIDTH= nor theNBINS= option is specified, the system determines the number of bins. If theBINSTART value results in excluding the entire range of data, it is ignored and thedefault BINSTART value is used.

Default: Determined by the system.

See also: XVALUES= option

BINWIDTH=numberspecifies the bin width. The system determines the number of bins. The bins alwaysspan the range of the data.

Default: Determined by the system.

Interaction: This option is ignored if the NBINS= option is also specified

254 Chapter 26 • HISTOGRAM Statement

Page 265: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

BOUNDARY=UPPER | LOWERspecifies how a boundary is counted when it lies on the endpoint of a bin. If this optionis set to UPPER, then the value is counted as one of the values in the upper bin (the binto the right). Otherwise, it is counted in the lower bin.

Default: UPPER

DATATRANSPARENCY=numberspecifies the degree of the transparency of the bars (outline and fill).

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | ( display-options )specifies whether to display outlined bars, filled bars, or outlined and filled bars.

Default: The GraphHistogram:DisplayOpts style reference.

STANDARDdisplays outlined, filled bars

ALLdisplays outlined, filled bars

(display-options)a list of comma-separated options enclosed in parentheses. Any of the options fromthe OUTLINEATTRS= and FILLATTRS= options can be used. The specified listmust include one of the following:

OUTLINE—displays outlined bars

FILL—displays filled bars

Use the OUTLINEATTRS= and FILLATTRS= options to control the appearance ofthe bars.

ENDLABELS=booleanspecifies whether the axis ticks and value labels are drawn at the bin endpoints or binmidpoints.

Default: FALSE

Interaction: If this option is set to FALSE, then the axis ticks and value labels aredrawn at the bin midpoints, whether the XVALUES= option identifies the X data asendpoint values or midpoint values.

Interaction: If BINAXIS=FALSE or this HISTOGRAM is not the primary plot, thenthis option is ignored.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the interior fill area of the bars. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “FillOptions” on page 564 for available fill-options.

Default: The GraphDataDefault style element

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

FREQ=numeric-column | expressionspecifies a column that indicates a frequency count for each observation of the inputdata object. If n is the value of the FREQ variable for a given observation, then thatobservation is plotted n times.

Default: Each observation has a frequency count of 1.

Example Program and Statement Details 255

Page 266: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: If the value of the numeric-column is missing or is less than 1, theobservation is not used in the analysis. If the value is not an integer, only the integerportion is used.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

NAME= "string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

NBINS=integerspecifies the number of bins. The system determines the BINWIDTH= value. The binsalways span the range of the data.

Default: Determined by the system.

ORIENT=VERTICAL | HORIZONTALspecifies the orientation of the Y axis and the bars.

Default: VERTICAL

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the line properties of the bar outlines. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphDataDefault style element.

Interaction: For this option to have any effect, the outlines must be enabled by theODS style or the DISPLAY= option.

PRIMARY=booleanspecifies that the data columns for this plot be used for determining default axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see SECTION ONSHARED DATA

SCALE=PERCENT | COUNT | PROPORTIONspecifies whether the Y axis displays the percentages between 0 and 100, or thefrequency counts, or the proportions between 0 and 1.

Default: PERCENT

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

256 Chapter 26 • HISTOGRAM Statement

Page 267: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column. The X role represents the binned value. The Y rolerepresents the computed amount of X in the units specified by the SCALE= option.

(role-format-list)a list of rolename = format pairs separated by blanks.

TIPFORMAT=( Y=PERCENT7.2)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role. The Xrole represents the binned value. The Y role represents the computed amount of X inthe units specified by the SCALE= option.

(role-label-list)a list of rolename = "string" pairs separated by blanks.

TIPLABEL=( Y="Percent")

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

XVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTSspecifies whether the X values represent lower endpoints, midpoints, or upper endpointsof the bins. For example, if BINSTART=10 and BINWIDTH=10, using LEFTPOINTSwould result in bins 10 - 20, 20 - 30, and so on. Using RIGHTPOINTS would result inbins 0 - 10, 10 - 20, ...., and using MIDPOINTS would result in bins 5 - 15, 15 - 25, ... .

Default: MIDPOINTS

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 257

Page 268: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

258 Chapter 26 • HISTOGRAM Statement

Page 269: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 27

HISTOGRAMPARM Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

Description and SyntaxCreates a univariate histogram for specified values of bin midpoints and bin frequencies.

HISTOGRAMPARM X = numeric-column | expressionY = non-negative-numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 260:

259

Page 270: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph histogramparm; begingraph; entrytitle "Histogram of Vehicle Weights"; layout overlay; histogramparm x=midpoint y=frequency; endlayout; endgraph; end;run;

data bins; input Midpoint Frequency; label midpoint="Vehicle Weight (LBS)";datalines;2000 183000 2084000 1595000 366000 67000 1;run;

proc sgrender data=bins template=histogramparm;run;

260 Chapter 27 • HISTOGRAMPARM Statement

Page 271: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement SummaryWhen a curve is overlaid on the histogram, the histogram bin width is used to scale thecurve so that the area under the curve is equal to the area of the histogram.

Required ArgumentsX=numeric-column | expression

specifies the column for the midpoint values.

Requirement: The X values must be uniformly spaced.

Y=non-negative-numeric-column | expressionspecifies the column for the frequency values. These values can be frequency counts,percentages, or proportions between 0 and 1.

Requirement: The Y values cannot be negative.

Options

Statement Option Description

BINAXIS Specifies whether to use bins as the basis foraxis tick marks.

DATATRANSPARENCY Specifies the degree of the transparency of thebars.

DISPLAY Specifies whether to display outlined bars,filled bars, or outlined and filled bars.

ENDLABELS Specifies whether axis ticks and value labels aredrawn at the endpoints of the bins or themidpoints of the bins.

FILLATTRS Specifies the appearance of the interior fill areaof the bars.

LEGENDLABEL Specifies a label for use in a legend.

NAME Assigns a name to a plot statement for referencein other template statements.

ORIENT Specifies the orientation of the Y axis and thebars.

OUTLINEATTRS Specifies the properties of the bar outlines.

PRIMARY Specifies that the data columns for this plot beused for determining default axis features.

ROLENAME Specifies roles for information defined by datacolumns.

Example Program and Statement Details 261

Page 272: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

TIP Specifies the information to display when thecursor is positioned over a histogram bin.

TIPFORMAT Specifies display formats for tip columns.

TIPLABEL Specifies display labels for tip columns.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

XVALUES Specifies whether the X values representmidpoints, lower endpoints, or upper endpointsof the bins.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

BINAXIS=booleanSpecifies whether to use bins as the basis for axis tick marks.

Default: TRUE

FALSEThe ENDLABELS= option is ignored. A standard axis is used, ignoring binboundaries and midpoints.

TRUEThe ENDLABELS= option determines how the axis ticks and value labels aredisplayed. The axis ticks are in predetermined locations and cannot be changed withaxis suboptions such TICKVALUELIST= and TICKVALUESEQUENCE=.

Interaction: When this option is set to TRUE, some X-axis options that are set on theparent layout might not apply.

Interaction: This option is ignored if this HISTOGRAMPARM is not the primary plot(for more information about primary plots, see “When Plots Share Data and a CommonAxis” on page 397).

DATATRANSPARENCY= numberspecifies the degree of the transparency of the bars (outline and fill).

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | ( display-options )specifies whether to display outlined bars, filled bars, or outlined and filled bars.

Default: The GraphHistogram:DisplayOpts style reference.

STANDARDdisplays outlined, filled bars

ALLdisplays outlined, filled bars

262 Chapter 27 • HISTOGRAMPARM Statement

Page 273: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

(display-options)a list of comma-separated options enclosed in parentheses. Any of the options fromthe OUTLINEATTRS= and FILLATTRS= options can be used. The specified listmust include one of the following:

OUTLINE—displays outlined bars

FILL—displays filled bars

Use the OUTLINEATTRS= and FILLATTRS= options to control the appearance ofthe bars.

ENDLABELS=booleanspecifies whether axis ticks and value labels are drawn at the endpoints of the bins ormidpoints of the bins.

Default: FALSE

Interaction: If this option is set to FALSE, then the axis ticks and value labels aredrawn at the bin midpoints. This occurs whether the BINVALUES= option identifiesthe X data as endpoint values or midpoint values.

Interaction: If BINAXIS=FALSE or this HISTOGRAMPARM is not the primary plot,then this option is ignored.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the interior fill area of the bars. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “FillOptions” on page 564 for available fill-options.

Default: The GraphDataDefault style element

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

NAME= "string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

ORIENT=VERTICAL | HORIZONTALspecifies the orientation of the Y axis and the bars.

Default: VERTICAL

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the line properties of the bar outlines. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphDataDefault style element.

Example Program and Statement Details 263

Page 274: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: For this option to have any effect, the outlines must be enabled by theODS style or the DISPLAY= option.

PRIMARY=booleanspecifies that the data columns for this plot be used for determining default axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

ROLENAME=( role-name-list )specifies user-defined roles for information contained in data columns.

Default: no default

(role-name-list)a blank-separated list of rolename = column pairs.

For example, ROLENAME= ( TIP1=PCT ) assigns the column PCT to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X and Y.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

TIP=(role-list)specifies the information to display when the cursor is positioned over a histogram bin.If this option is used, it replaces all the information displayed by default. Roles forcolumns that do not contribute to the histogram can be specified along with roles thatdo.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X and Y.

(role-list)an ordered, blank-separated list of unique HISTOGRAMPARM and user-definedroles. HISTOGRAMPARM roles include X and Y.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles Xand Y, as well as the column PCT, which is not assigned to any pre-definedHISTOGRAMPARM role. The PCT column must first be assigned a role.:

ROLENAME=(TIP1=PCT) TIP= (X Y TIP1)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

264 Chapter 27 • HISTOGRAMPARM Statement

Page 275: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of rolename = format pairs separated by blanks.

ROLENAME=(TIP1=PCT) TIP=(X Y TIP1) TIPFORMAT=( TIP1=PERCENT7.2)

Requirement: This option provides a way to control the formats of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of rolename = "string" pairs separated by blanks.

ROLENAME=(TIP1=PCT) TIP=(X Y TIP1) TIPLABEL=( TIP1="Percent")

Requirement: This option provides a way to control the labels of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

XVALUES=MIDPOINTS | LEFTPOINTS | RIGHTPOINTSspecifies whether the X values represent midpoints, lower endpoints, or upper endpointsof the bins.

Default: MIDPOINTS

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 265

Page 276: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

266 Chapter 27 • HISTOGRAMPARM Statement

Page 277: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 28

LINEPARM Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

Description and SyntaxCreates a straight line specified by a point and a slope.

LINEPARM X = number | numeric-column | expressionY = number | numeric-column | expressionSLOPE = number | numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 268:

267

Page 278: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThe LINEPARM statement draws a line based on a point and the slope of the line thatpasses through that point. You can use this statement to create a reference line with anyslope or, in this example, to draw a fit from a linear regression. Many SAS/STATprocedures create output data sets containing a Y-intercept and slope and coefficient forthe linear regression equation.

proc template; define statgraph lineparm; begingraph; entrytitle "Robust Fit of Height and Weight by Sex "; layout overlay / xaxisopts=(offsetmax=.35); scatterplot x=height y=weight / group=sex markercharacter=eval(substr(sex,1,1)) markercharacterattrs=(size=5pt) datatransparency=.7; lineparm x=0 y=intercept slope=slope / name="Line" group=sex curvelabel=eval("Weight = "||put(slope,5.3)|| " * Height + "||put(intercept,6.1)) curvelabellocation=inside curvelabelattrs=(size=8pt); discretelegend "Line"; endlayout; endgraph; end;run;

proc sort data=sashelp.heart(keep=height weight sex) out=heart; by sex;run;

268 Chapter 28 • LINEPARM Statement

Page 279: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ods exclude all;proc robustreg data=heart method=m outest=stats(rename=(height=slope)); by sex; model weight=height;run;

data all; merge heart stats(keep=intercept slope sex);run;

ods select all;proc sgrender data=all template=lineparm;run;

Statement SummaryThe LINEPARM statement creates a straight line. You can generate a single line byspecifying a constant for each required argument. You can generate multiple lines byspecifying a numeric column for any or all required arguments. If any of the X= or Y=columns contains a missing value, no line is drawn. To request a vertical line, specifySLOPE= . (specify a missing value as a constant or column value).

A LINEPARM statement can be used in any layout except GRIDDED or OVERLAY3Dlayouts. The parent layout must include another plot statement that is derived from datavalues that establish a data range for the axes. For example, it can be used with a scatterplot or a histogram.

To draw vertical or horizontal reference lines, consider using the simplerREFERENCELINE statement.

Required ArgumentsX=number | numeric-column | expression

specifies the X coordinate of a point.

By default, if the specified value is outside of the data range, then the data range isextended to include the specified intercept. This behavior can be changed with theCLIP= option. If a numeric-column is specified and the column contains missing values,no line is drawn for the missing values.

Values are displayed in the units of the data.

Y=number | numeric-column | expressionspecifies the Y coordinate of a point.

By default, if the specified value is outside of the data range, then the data range isextended to include the specified intercept. This behavior can be changed with theCLIP= option. If a numeric-column is specified and the column contains missing values,no line is drawn for the missing values.

Values are displayed in the units of the data.

SLOPE=number | numeric-column | expressionspecifies the slope of the line.

Slope can be positive or negative.

Example Program and Statement Details 269

Page 280: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

SLOPE= 0 creates a line parallel to the X-axis. SLOPE= . (a missing value) createsa line parallel to the Y-axis.

Options

Statement Option Description

CLIP Specifies whether the data for the line areconsidered when determining the data rangesfor the axes.

CURVELABEL Specifies the label of the line.

CURVELABELATTRS Specifies the color and font attributes of the linelabel.

CURVELABELLOCATION Specifies the location of the line label relativeto the plot area.

CURVELABELPOSITION Specifies the position of the line label relativeto the line end points.

DATATRANSPARENCY Specifies the degree of the transparency of thelines.

EXTEND Specifies whether the line is to be drawn to thearea bounded by the axes, ignoring anyspecified offsets.

GROUP Creates a separate parameterized line plot foreach unique group value of the specifiedcolumn.

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the properties of the line.

NAME Assigns a name to a plot statement for referencein other template statements.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

270 Chapter 28 • LINEPARM Statement

Page 281: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

CLIP= booleanspecifies whether the data for the line are considered when determining the data rangesfor the axes.

Default: FALSE

FALSEThe data for the line contributes to data range for each axis. Each axis might beextended to force the display of the line.

TRUEThe data for the line are ignored when establishing axis scales. Each axis scale isdetermined by the other plots in the layout. This might result in the line not beingdisplayed if its data range is not within the data ranges of the other plots.

CURVELABEL= "string" | column | expressionspecifies a label for the line.

Default: no default

Interaction:

• For a single line, use "string".

• For multiple lines, use a column to define the labels for each unique value.

The font and color attributes for the label are specified by theCURVELABELATTRS= option.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the line label. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options” onpage 566 for available text-options.

Default:

• For non-grouped data, the GraphValueText style element.

• For grouped data, text color is derived from the GraphData1:ContrastColor -GraphDataN:ContrastColor style references. The font is derived from theGraphValueText style element.

Interaction: For this option to take effect, the CURVELABEL= option must also beused.

Interaction: This option’s COLOR= setting overrides the colors indicated by theGROUP= option.

When the GROUP= option is used, each distinct group value might be represented bya different color. The line label that is associated with the group is assigned the groupcolor. This option can be used to specify a single color for all line labels in a graph,without affecting the line colors.

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the line label relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

OUTSIDEoutside the plot area

Example Program and Statement Details 271

Page 282: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: OUTSIDE cannot be used when the LINEPARM is used in multi-celllayouts such as LATTICE, DATAPANEL, or DATALATTICE, where axes might beexternal to the grid.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the line labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

CURVELABELPOSITION=AUTO | MAX | MINspecifies the position of the line label relative to the line end points.

Default: AUTO when CUVELABELLOCATION=OUTSIDE MAX whenCURVELABELLOCATION=INSIDE

AUTOOnly used when CURVELABELLOCATION=OUTSIDE. The line label ispositioned automatically near the line boundary along unused axes wheneverpossible (typically Y2 and X2) to avoid collision with tick values.

MAXForces the line label to appear near maximum line values (typically, upper right).

MINForces the line label to appear near minimum line values (typically, lower left).

Restriction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with the CURVELABELLOCATION=option to determine where the line label appears. For more information, see “Locationand Position of Curve Labels” on page 123.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the line.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

EXTEND=booleanspecifies whether the line is to be drawn to the area bounded by the axes.

Default: FALSE

If this option is not specified, then there can be a small gap between the line and theaxis. The gap is controlled by the axis offset. If the offset is set to 0, then there is nogap.

GROUP=column | expressioncreates a separate parameterized line plot for each unique group value of the specifiedcolumn.

Default: Each distinct group value might be represented in the graph by a differentcombination of line color and line pattern. Line colors vary according to theGraphData1:ContrastColor - GraphDataN:ContrastColor style references, and linepatterns vary according to the GraphData1:LineStyle - GraphDataN:LineStyle stylereferences.

272 Chapter 28 • LINEPARM Statement

Page 283: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: When this option is used, the X, Y, and SLOPE arguments must specifynumeric columns.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of line colors and line patterns.

The LINEATTRS= option can be used to override the representations that are used toidentify the groups. For example, LINEATTRS=(PATTERN=SOLID) can be used toassign the same pattern to all of the lines, letting the line color distinguish group values.Likewise, LINEATTRS=(COLOR=BLACK) can be used to assign the same color toall of the lines, letting the line pattern distinguish group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style element touse.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

Interaction: If the GROUP= option is specified, this option is ignored.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the line. See “General Syntax for Attribute Options” on page563 for the syntax on using a style-element and “Line Options” on page 564 foravailable line-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the ContrastColor, LineStyle, and LineThickness attributes ofthe GraphData1- GraphDataN style elements.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

Example Program and Statement Details 273

Page 284: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Restriction: Another plot that establishes a data range for the axis must be included.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Restriction: Another plot that establishes a data range for the axis must be included.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

274 Chapter 28 • LINEPARM Statement

Page 285: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 29

LOESSPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277Loess Regression Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

Description and SyntaxCreates a fitted loess curve computed from input data.

LOESSPLOT X = numeric-column | expressionY = numeric-column | expression</ <regression-options> <option(s)> >;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 276:

275

Page 286: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph loessplot; begingraph; entrytitle "Loess Fit Plot"; layout overlay; scatterplot x=weight y=mpg_highway / datatransparency=.7; loessplot x=weight y=mpg_highway / name="fitline" alpha=.05 legendlabel="Loess Fit"; discretelegend "fitline"; endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=loessplot;run;

Statement SummaryThe LOESSPLOT statement only supports statistical models of one independent and onedependent variable. For more information about the fitting methodology, see the LOESSprocedure in the MISSING Bookref .

In addition to the loess curve, the LOESSPLOT statement can compute confidence levelsfor the fitted line. To display the confidence levels,

1. use the CLM= option to declare a name for the confidence level of the mean

276 Chapter 29 • LOESSPLOT Statement

Page 287: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

2. use a MODELBAND statement to refer this name. This statement draws a confidenceband from this information. See “MODELBAND Statement” on page 283 forinformation about how to control the appearance of the confidence band.

Required ArgumentsX=numeric-column | expression

specifies the column for the X values.

Y=numeric-column | expressionspecifies the column for the Y values.

Loess Regression OptionsALPHA= positive-number

specifies the confidence level to compute.

Default: .05

Range: 0 < number < 1

Range: ALPHA=.05 represents a 95% confidence level.

CLM= "name"produces confidence limits for a mean predicted value for each observation. Theconfidence level is set by the ALPHA= option.

Default: no default

Interaction: "name" is a unique name within the template that is case sensitive andcannot contain spaces. It must be assigned in order for the confidence limits to becomputed. To display confidence limits, you must use this name as the requiredargument of a MODELBAND statement.

DEGREE=1 | 2specifies the degree of the local polynomials to use for each local regression. The validvalues are 1 for local linear fitting or 2 for local quadratic fitting.

Default: 1

INTERPOLATION=LINEAR | CUBICspecifies the degree of the interpolating polynomials used for blending local polynomialfits at the kd tree vertices.

Default: LINEAR

CUBICcubic polynomials

LINEARlinear polynomials

MAXPOINTS= positive-integerspecifies the maximum number of predicted points generated for the loess curve as wellas confidence limits.

Default: 201

SMOOTH=AUTO | positive-numberspecifies a regression parameter value.

Default: AUTO

Example Program and Statement Details 277

Page 288: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

REWEIGHT=NONE | positive-integerspecifies the number of iterative re-weighting steps to be done. Such iterations areappropriate when there are outliers in the data or when the error distribution is asymmetric long-tailed distribution.

Default: NONE

WEIGHT= numeric-columnspecifies a variable in the input data set that contains values to be used as a priori weightsfor a loess fit. The values of the weight variable must be nonnegative. If an observation’sweight is zero, negative, or missing, the observation is deleted from the analysis.

Default: no default

Options

Statement Option Description

CURVELABEL Specifies the label of the loess curve.

CURVELABELATTRS Specifies the color and font attributes of thecurve label.

CURVELABELLOCATION Specifies the location of the curve label relativeto the plot area.

CURVELABELPOSITION Specifies the position of the curve label relativeto the curve line.

DATATRANSPARENCY Specifies the degree of the transparency of theloess curve.

GROUP Creates a distinct set of curves from just theobservations that correspond to each uniquegroup value of the specified column.

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the properties of the loess curve.

NAME Assigns a name to a plot statement for referencein other template statements.

PRIMARY Specifies that the data columns for this plot beused for determining default axis features.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

278 Chapter 29 • LOESSPLOT Statement

Page 289: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CURVELABEL="string"specifies a label for the loess curve.

Default: no default

Interaction: If the GROUP= option is specified, this option is ignored.

The font and color attributes for the label are specified by the CURVELABELATTRS=option.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the curve labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: If the GROUP= option is specified, this option is ignored.

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the curve label relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the LOESSPLOT is used in multicelllayouts such as LATTICE, DATAPANEL, or DATALATTICE, where axes might beexternal to the grid.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the curve labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

CURVELABELPOSITION=AUTO | MAX | MIN | START | ENDspecifies the position of the curve label relative to the curve line.

Default: AUTO when CUVELABELLOCATION=OUTSIDE, and END whenCURVELABELLOCATION=INSIDE

Example Program and Statement Details 279

Page 290: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

AUTOOnly used when CURVELABELPOSITION=OUTSIDE. The curve label ispositioned automatically near the curve boundary along unused axes wheneverpossible (typically Y2 and X2) to avoid collision with tick values.

MAXForces the curve label to appear near maximum curve values (typically, upper right).

MINForces the curve label to appear near minimum curve values (typically, lower left).

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces the curve label toappear near the beginning of the curve. Particularly useful when the curve line hasa spiral shape.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces the curve label toappear near the end of the curve. Particularly useful when the curve line has a spiralshape.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified. The START and END settings arenot supported if CURVELABELLOCATION=OUTSIDE is specified.

Interaction: This option is used in conjunction with the CURVELABELLOCATION=option to determine where the curve label appears. For more information, see “Locationand Position of Curve Labels” on page 123.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the loess curve.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

GROUP=column | expressioncreates a distinct set of curves from just the observations that correspond to each uniquegroup value of the specified column.

Default: Each distinct group value might be represented in the graph by a differentcombination of color and line pattern. Line colors vary according to theGraphData1:ContrastColor - GraphDataN:ContrastColor style references, and linepatterns vary according to the GraphData1:LineStyle - GraphDataN:LineStyle stylereferences.

Restriction: The input data must be sorted by the GROUP= column.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of line colors and line patterns.

The LINEATTRS= option can be used to override the representations that are used toidentify the groups. For example, LINEATTRS=(PATTERN=SOLID) can be used toassign the same pattern to all of the loess curves, letting the line color distinguish groupvalues. Likewise, LINEATTRS=(COLOR=BLACK) can be used to assign the samecolor to all of the curves, letting the line pattern distinguish group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) to one of theGraphData1 - GranphDataN style elements.

280 Chapter 29 • LOESSPLOT Statement

Page 291: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style element touse.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label to be used in a legend.

Default: The string specified on the NAME= option.

Interaction: If the GROUP= option is specified, this option is ignored.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the loess curve. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default: The GraphFit style element.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

Example Program and Statement Details 281

Page 292: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

(role-format-list)a list of role-name = format pairs separated by blanks.

TIPFORMAT=(Y=6.2)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

The columns assigned to the X, Y, and GROUP (if assigned) roles are automaticallyincluded in the tooltip information.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of role-name = "string" pairs separated by blanks.

TIPLABEL=(Y="Loess Fit")

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

The columns assigned to the X, Y, and GROUP (if assigned) roles are automaticallyincluded in the tooltip information.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

282 Chapter 29 • LOESSPLOT Statement

Page 293: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 30

MODELBAND Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

Description and SyntaxCreates a band showing confidence limits for an associated smoother plot.

MODELBAND "confidence-name" </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 284:

283

Page 294: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph modelband; begingraph; entrytitle "Spline Fit with Confidence Bands"; layout overlay; modelband "cliband" / name="confband1" display=all legendlabel="90% CLI" fillattrs=GraphConfidence; modelband "clmband" / name="confband2" display=all legendlabel="90% CLM" fillattrs=GraphConfidence2; scatterplot x=weight y=mpg_highway / datatransparency=.7; pbsplineplot x=weight y=mpg_highway / name="fitline" clm="clmband" cli="cliband" alpha=.1 legendlabel="Spline Fit"; discretelegend "fitline" "confband1" "confband2"; endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=modelband;run;

Statement SummaryA MODELBAND statement must be associated with a smoother statement (LOESSPLOT,REGRESSIONPLOT, or PBSPLINEPLOT) that specifies a fitted model and a type ofconfidence level to compute. The example program uses a PBSPLINEPLOT statement.

284 Chapter 30 • MODELBAND Statement

Page 295: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Required Arguments"confidence-name"

specifies the case-sensitive name assigned to a confidence option in a smoother plotstatement.

Requirement:confidence-name must have been assigned to the CLM= or CLI= optionon a smoother plot statement such as LOESSPLOT, REGRESSIONPLOT, orPBSPLINEPLOT.

Options

Option Description

CURVELABELATTRS Specifies the color and font attributes of theupper and lower band labels.

CURVELABELLOWER Specifies a label for the lower band limit.

CURVELABELUPPER Specifies a label for the upper band limit.

CURVELABELLOCATION Specifies the location of the band labels relativeto the plot area.

CURVELABELPOSITION Specifies the position of the band label relativeto the band line.

DATATRANSPARENCY Specifies the degree of the transparency of theband.

DISPLAY Specifies whether to display an outlined bandarea, a filled band area, or an outlined and filledband area.

FILLATTRS Specifies the appearance of the band area.

LEGENDLABEL Specifies a label for use in a legend.

NAME Assigns a name to a plot statement for referencein other template statements.

OUTLINEATTRS Specifies the properties of the band lines.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

Example Program and Statement Details 285

Page 296: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Option Description

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the upper and lower band labels. See “GeneralSyntax for Attribute Options” on page 563 for the syntax on using a style-element and“Text Options” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: For this option to take effect, the CURVELABELLOWER= orCURVELABELUPPER= option must also be specified.

Interaction: If the smoother statement’s GROUP= option is specified, this option isignored.

CURVELABELLOWER="string"specifies a label for the lower band limit.

Default: no default

Interaction: If the smoother statement’s GROUP= option is specified, this option isignored.

The font and color attributes for the label are specified by theCURVELABELATTRS= option.

CURVELABELUPPER="string"specifies a label for the upper band limit.

Default: no default

Interaction: If the smoother statement’s GROUP= option is specified, this option isignored.

The font and color attributes for the label are specified by theCURVELABELATTRS= option.

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the band labels relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the MODELBAND is used in multi-celllayouts such as LATTICE, DATAPANEL, or DATALATTICE, where axes might beexternal to the grid.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the band labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

Interaction: For this option to take effect, the CURVELABELLOWER= orCURVELABELUPPER= option must also be specified.

286 Chapter 30 • MODELBAND Statement

Page 297: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

CURVELABELPOSITION=AUTO | MAX | MIN | START | ENDspecifies the position of the band label relative to the band line.

Default: AUTO when CUVELABELLOCATION=OUTSIDE END whenCURVELABELLOCATION=INSIDE

AUTOOnly used when CURVELABELPOSITION=OUTSIDE. Band labels arepositioned automatically near the band boundary along unused axes wheneverpossible (typically Y2 and X2).

MAXForces the band label to appear near maximum band values (typically, upper right)

MINForces the band label to appear near minimum band values (typically, lower left)

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces the band label toappear near the beginning of the band. Particularly useful when the curve line hasa spiral shape.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces the band label toappear near the end of the band. Particularly useful when the curve line has a spiralshape.

Interaction: For this option to take effect, the CURVELABELLOWER= orCURVELABELUPPER= option must also be specified.

Restriction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified. The START and END settings arenot supported if CURVELABELLOCATION=OUTSIDE is specified.

Interaction: This option is used in conjunction with the CURVELABELLOCATION=option to determine where the band label appears. For more information, see “Locationand Position of Curve Labels” on page 123.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the band. This option affects both the filland outline.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | ( display-options )specifies whether to display an outlined area, a filled area, or an outlined and filledmodelband area.

Default: The GraphBand:DisplayOpts style reference.

STANDARDdisplays a filled band with no outlined

ALLdisplays an outlined, filled band

(display-options)a list of options, enclosed in parentheses, that must include one of the following:

OUTLINE—displays an outlined band

FILL—displays a filled band

Example Program and Statement Details 287

Page 298: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Use the OUTLINEATTRS= and FILLATTRS= options to control the appearance ofthe band.

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the appearance of the filled modelband area. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Fill Options” onpage 564 for available fill-options.

Default:

• For non-grouped data, the GraphConfidence:Color style reference.

• For grouped data, the GraphData1:Color - GraphDataN:Color style references.

Interaction: For this option to have any effect, the fill must be enabled by the ODSstyle or the DISPLAY= option.

LEGENDLABEL= "string"specifies a label to be used in a legend.

Default: The string specified on the NAME= option.

Interaction: The smoother statement’s GROUP= option overrides this option.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

OUTLINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the modelband outlines. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default:

• For non-grouped data, the GraphConfidence style element.

• For grouped data, the GraphData1: ContrastColor - GraphDataN:ContrastColorstyle references.

Interaction: If DISPLAY=(FILL), this option has no effect.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of role-name = format pairs separated by blanks.

The role-names X, LIMITLOWER, LIMITUPPER, GROUP, and INDEX areavailable to indicate which tooltip values to format.

TIPFORMAT=(LIMITUPPER=5.3 LIMITLOWER=5.3)

288 Chapter 30 • MODELBAND Statement

Page 299: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of role-name = "string" pairs separated by blanks.

The role-names X, LIMITLOWER, LIMITUPPER, GROUP, and INDEX areavailable to indicate which tooltip values to label.

TIPLABEL=(LIMITUPPER="90% CLM"LIMITLOWER="90% CLM")

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

The setting for this option should be the same as for the smoother statement referencedby “"confidence-name" ”.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

The setting for this option should be the same as for the smoother statement referencedby “"confidence-name" ”.

Example Program and Statement Details 289

Page 300: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

290 Chapter 30 • MODELBAND Statement

Page 301: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 31

NEEDLEPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

Description and SyntaxCreates a plot of observations as points connected to a baseline by vertical line segments.

NEEDLEPLOT X = column | expressionY = numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 292:

291

Page 302: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph needleplot; begingraph; entrytitle "IBM Stock Trend"; layout overlay; needleplot x=date y=close / baselineintercept=80 lineattrs=(color=blue); endlayout; endgraph; end;run;

proc sgrender data=sashelp.stocks template=needleplot; where stock="IBM" and date > "31dec1999"d;run;

Statement SummaryIn the NEEDLEPLOT statement, the X variable can specify character or numeric values.The Y variable must specify numeric values. For character columns, the X-axis is alwaysof TYPE=DISCRETE. For numeric columns, the X-axis is of TYPE=LINEAR by default.

The Y-axis is of TYPE=LINEAR by default.

Required ArgumentsX=column | expression

specifies a column or expression for the X values.

292 Chapter 31 • NEEDLEPLOT Statement

Page 303: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Y=numeric-column | expressionspecifies a numeric column or numeric expression for the Y values.

Options

Statement Option Description

BASELINEINTERCEPT Specifies the Y-intercept for the baseline.

DATALABEL Specifies labels at the data points.

DATALABELATTRS Specifies the color and font attributes of the datalabels.

DATATRANSPARENCY Specifies the degree of the transparency of theneedles and the markers, if displayed.

DISPLAY Specifies whether to display needle lines withor without markers.

GROUP Creates a separate needle plot for each uniquegroup value of the specified column.

INDEX Specifies indices for mapping needle attributes(color, marker symbol, and line pattern) to oneof the GraphData1 - GranphDataN styleelements.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the properties of the needles.

MARKERATTRS Specifies the attributes of the data markers.

NAME Assigns a name to a plot statement for referencein other template statements.

PRIMARY Specifies that the data columns for this plot beused for determining default axis features.

ROLENAME Specifies roles for information defined by datacolumns.

TIP Specifies the information to display when thecursor is positioned over a needle line ormarker.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

Example Program and Statement Details 293

Page 304: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

URL Specifies an HTML page to display when aneedle line is selected.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

BASELINEINTERCEPT=number | RELATIVEspecifies the Y-intercept for the baseline.

Default: 0

numberThe Y-intercept value to use for the baseline.

RELATIVEThe baseline is placed at the Y-axis tick mark closest to the minimum of the rangefor the needle data points.

DATALABEL=columnspecifies labels at the data points.

Default: no default

The position of the labels is adjusted to prevent the labels from overlapping.

DATALABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the data labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphValueText style element.

• For grouped data, the GraphData1:ContrastColor - GraphDataN:ContrastColorstyle references.

Interaction: For this option to have any effect, the DATALABEL= option must alsobe specified.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the needles and markers, if displayed.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISPLAY=STANDARD | ALL | display-optionsspecifies whether to display needle lines with or without markers.

Default: STANDARD

STANDARDdisplays needle lines without markers.

ALLdisplays needle lines with markers.

294 Chapter 31 • NEEDLEPLOT Statement

Page 305: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

(display-options)a list of options, enclosed in parentheses. Currently only the following option isavailable:

MARKERS—displays needle lines with markers

Use the MARKERATTRS= and LINEATTRS= options to control the appearance ofthe line and markers.

GROUP=column | expressioncreates a distinct set of needles, markers, and data labels for each unique group valueof the specified column.

Default: Each distinct group value might be represented in the graph by a differentcombination of color, line pattern, and marker symbol. These vary according to theContrastColor, LineStyle, and MarkerSymbol attributes of the GraphData1 -GraphDataN style elements.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of marker symbols, colors, andline patterns.

Interaction: The marker size is set by the MARKERATTRS= option.

The representations that are used to identify the groups can be overridden. For example,each distinct group value might be represented by a different line pattern, but theLINEATTRS= ( PATTERN=pattern ) option could be used to assign the same linepattern to all of the plot’s line patterns, letting line color indicate group values.Likewise, LINEATTRS= ( COLOR= color ) could be used to assign the same color toall lines, letting line pattern indicate group values.

INDEX=positive-integer-columnspecifies indices for mapping needle attributes (color, marker symbol, and line pattern)to one of the GraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to have any effect, the GROUP= option must also bespecified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style element touse.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"Specifies a label for use in a legend.

Default: The Y-variable label. If a label is not defined, the Y-variable name.

Interaction: If the GROUP= option is specified, this option is ignored.

Example Program and Statement Details 295

Page 306: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the needles for the data points. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the ContrastColor, LineStyle and LineThickness attributes of theGraphData1 - GraphDataN style elements.

MARKERATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the data markers. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Marker Options” on page565 for available marker-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the MarkerSymbol, MarkerSize, and ContrastColor attributes ofthe GraphData1 - GraphDataN style elements.

Interaction: The DISPLAY= option must display markers for this option to have anyeffect.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use ofcolors, marker symbols, and line patterns between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot be used for determining default axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

ROLENAME=( role-name-list )specifies user-defined roles for information contained in data columns.

Default: no default

(role-name-list)a blank-separated list of rolename = column pairs.

For example, ROLENAME= ( TIP1=OBS ) assigns the column OBS to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X, Y, DATALABEL, INDEX, and GROUP.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

296 Chapter 31 • NEEDLEPLOT Statement

Page 307: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TIP=(role-list)specifies the information to display when the cursor is positioned over a needle line ormarker. If this option is used, it replaces all the information displayed by default. Rolesfor columns that do not contribute to the needle plot can be specified along with rolesthat do.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X, Y, DATALABEL, and GROUP.

(role-list)an ordered, blank-separated list of unique NEEDLEPLOT and user-defined roles.NEEDLEPLOT roles include X, Y, DATALABEL, and GROUP.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles Xand Y as well as the column OBS, which is not assigned to any pre-definedNeedlePlot role. The OBS column must first be assigned a role.

ROLENAME=(TIP1=OBS) TIP= (TIP1 X Y)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of rolename = format pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X Y) TIPFORMAT=(TIP1=4.)

Requirement: This option provides a way to control the formats of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of rolename = "string" pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X Y) TIPLABEL=(TIP1="Observation #")

Requirement: This option provides a way to control the labels of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

Example Program and Statement Details 297

Page 308: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

URL=character-columnspecifies an HTML page to display when a needle or marker is selected.

Default: no default

character-columneach value of the column must be a valid HTML page reference (HREF). Forexample, http://www.sas.com/technologies/analytics/index.html

Requirement: To generate selectable needles, you must include an ODS GRAPHICSON statement that has the IMAGEMAP option specified, and write the graphs to theODS HTML destination.

The URL value can be blank for some X and Y pairs, meaning that no action is takenwhen the corresponding needle or marker is selected. The URL value can be the samefor any X and Y pairs. In that case, the same action is taken when the needle or markeris selected for those X and Y pairs.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

298 Chapter 31 • NEEDLEPLOT Statement

Page 309: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 32

PBSPLINEPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301PBSPLINE Regression Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

Description and SyntaxCreates a fitted penalized B-spline curve computed from input data.

PBSPLINEPLOT X = numeric-column | expressionY = numeric-column | expression </ <regression-options> <option(s)>>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 300:

299

Page 310: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph pbsplineplot; begingraph; entrytitle "Spline Fit"; layout overlay; scatterplot x=weight y=mpg_highway / datatransparency=.7; pbsplineplot x=weight y=mpg_highway / name="fitline" alpha=.05 legendlabel="Spline Fit"; discretelegend "fitline"; endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=pbsplineplot;run;

Statement SummaryThe PBSPLINEPLOT statement only supports models of one independent and onedependent variable. For more information about the fitting methodology, see theTRANSREG procedure in the MISSING Bookref .

In addition to the penalized B-spline, the PBSPLINEPLOT statement can computeconfidence levels for the fitted line. To display the confidence levels,

1. use the CLI= or CLM= option to declare a name for the confidence level

300 Chapter 32 • PBSPLINEPLOT Statement

Page 311: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

2. use a MODELBAND statement to refer to this name. This statement draws a confidenceband from this information. See “MODELBAND Statement” on page 283 forinformation about how to control the appearance of the confidence band.

Required ArgumentsX=numeric-column | expression

specifies the column for the X values.

Y=numeric-column | expressionspecifies the column for the Y values.

PBSPLINE Regression OptionsALPHA= positive-number

specifies the confidence level to compute.

Default: .05

Range: 0 - 1

ALPHA=.05 represents a 95% confidence level.

CLI= "name"produces confidence limits for individual predicted values for each observation.

Default: no default

Interaction: name is a unique name within the template that is case sensitive and cannotcontain spaces. It must be assigned in order for the confidence limits to be computed.To display confidence limits, you must use this name as the required argument of aMODELBAND statement. See the example in the section “Example Program andStatement Details” on page 299.

CLM= "name"produces confidence limits for a mean predicted value for each observation.

Default: no default

Interaction: name is a unique name within the template that is case sensitive and cannotcontain spaces. It must be assigned in order for the confidence limits to be computed.To display confidence limits, you must use this name as the required argument of aMODELBAND statement. See the example in the section “Example Program andStatement Details” on page 299.

DEGREE= non-negative-integerspecifies the degree of B-spline.

Default: 3

FREQ= numeric-columnspecifies a variable in the input data set that represents the frequency of occurrence ofthe current observation, essentially treating the data set as if each observation appearedn times, where n is the value of the FREQ variable for the observation. Nonintegervalues of the FREQ variable are truncated to the largest integer less than the FREQvalue. The observation is used in the analysis only if the value of the FREQ variable isgreater than or equal to 1.

Default: no default

Example Program and Statement Details 301

Page 312: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

MAXPOINTS= positive-integerspecifies the maximum number of predicted points generated for the spline curve aswell as any confidence limits.

Default: 201

NKNOTS= non-negative-integerspecifies the number of evenly spaced internal knots.

Default: 100

By default, a large number of knots (100) is specified, which allows for an extremelack of smoothness in the results. However, the final function is typically muchsmoother due to the penalty. See the section and example on “Penalized B-Splines” inPROC TRANSREG. When SMOOTH=0 is specified, you should typically ask formany fewer knots than the default, since there is no penalty for lack of smoothness. Forexample, ten or fewer knots is usually enough to follow the functional form found inmost data. See “Using Splines and Knots” and “Specifying the Number of Knots” inPROC TRANSREG.

SMOOTH=AUTO | non-negative-numberspecifies a regression parameter value.

Default: AUTO

With SMOOTH=AUTO, a regression parameter is automatically selected thatminimizes a lack-of-smoothness penalty.

You can specify SMOOTH=0 to get an ordinary B-spline fit.

WEIGHT= numeric-columnspecifies a variable in the input data set that contains values to be used as a priori weightsfor a penalized B-spline fit. If an observation’s weight is zero, negative, or missing, theobservation is deleted from the analysis.

Default: no default

Options

Statement Option Description

CURVELABEL Specifies the label of the regression curve.

CURVELABELATTRS Specifies the color and font attributes of theregression curve label.

CURVELABELLOCATION Specifies the location of the regression curvelabel relative to the plot area.

CURVELABELPOSITION Specifies the position of the regression curvelabel relative to the curve line.

DATATRANSPARENCY Specifies the degree of the transparency of theregression curve.

GROUP Creates a distinct set of lines from just theobservations that correspond to each uniquegroup value of the specified column.

302 Chapter 32 • PBSPLINEPLOT Statement

Page 313: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the line properties of the regressioncurve.

NAME Assigns a name to a plot statement for referencein other template statements.

PRIMARY Specifies that the data columns for this plot beused for determining default axis features.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CURVELABEL="string"specifies a label for the regression curve.

Default: no default

Interaction: If the GROUP= option is specified, this option is ignored.

The font and color attributes for the label are specified by theCURVELABELATTRS= option.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the regression curve labels. See “GeneralSyntax for Attribute Options” on page 563 for the syntax on using a style-element and“Text Options” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: If the GROUP= option is specified, this option is ignored.

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the regression curve label relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

Example Program and Statement Details 303

Page 314: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the PBSPLINEPLOT is used in multicelllayouts such as LATTICE, DATAPANEL, or DATALATTICE, where axes might beexternal to the grid.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the curve labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

CURVELABELPOSITION=AUTO | MAX | MIN | START | ENDspecifies the position of the regression curve label relative to the curve line.

Default: AUTO when CUVELABELLOCATION=OUTSIDE END whenCURVELABELLOCATION=INSIDE

AUTOOnly used when CURVELABELPOSITION=OUTSIDE. The regression curvelabel is positioned automatically near the curve boundary along unused axeswhenever possible (typically Y2 and X2) to avoid collision with tick values.

MAXForces the regression curve label to appear near maximum curve values (typically,upper right)

MINForces the regression curve label to appear near minimum curve values (typically,lower left)

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces the regressioncurve label to appear near the beginning of the curve. Particularly useful when thecurve line has a spiral shape.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces the regressioncurve label to appear near the end of the curve. Particularly useful when the curveline has a spiral shape.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified. The START and END settings arenot supported if CURVELABELLOCATION=OUTSIDE is specified.

Interaction: This option is used in conjunction with the CURVELABELLOCATION=option to determine where the regression curve label appears. For more information,see “Location and Position of Curve Labels” on page 123.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the curve.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

GROUP=column | expressioncreates a distinct set of curves from just the observations that correspond to each uniquegroup value of the specified column.

304 Chapter 32 • PBSPLINEPLOT Statement

Page 315: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: Each distinct group value might be represented in the graph by a differentcombination of color and line pattern. Line colors vary according to theGraphData1:ContrastColor - GraphDataN:ContrastColor style references, and linepatterns vary according to the GraphData1:LineStyle - GraphDataN:LineStyle stylereferences.

Restriction: The input data must be sorted by the GROUP= column.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of line colors and line patterns.

The LINEATTRS= option can be used to override the representations that are used toidentify the groups. For example, LINEATTRS=(PATTERN=SOLID) can be used toassign the same pattern to all of the loess curves, letting the line color distinguish groupvalues. Likewise, LINEATTRS=(COLOR=BLACK) can be used to assign the samecolor to all of the curves, letting the line pattern distinguish group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style element touse.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label for use in a legend.

The string specified on the NAME= option.

Interaction: If the GROUP= option is specified, this option is ignored.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the line attributes of the regression curve. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphFit style element.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

Example Program and Statement Details 305

Page 316: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of role-name = format pairs separated by blanks.

TIPFORMAT=(Y=6.2)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

The columns assigned to the X, Y, and GROUP (if assigned) roles are automaticallyincluded in the tooltip information.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of role-name = "string" pairs separated by blanks.

TIPLABEL=(Y="Spline Regression")

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

The columns assigned to the X, Y, and GROUP (if assigned) roles are automaticallyincluded in the tooltip information.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

306 Chapter 32 • PBSPLINEPLOT Statement

Page 317: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 307

Page 318: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

308 Chapter 32 • PBSPLINEPLOT Statement

Page 319: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 33

REFERENCELINE Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311

Description and SyntaxCreates a horizontal or vertical reference line.

Syntax for creating a line perpendicular to the X-axis at an X-intercept:

REFERENCELINE X = x-axis-value | column | expression </option(s)>;

Syntax for creating a line perpendicular to the Y-axis at a Y-intercept:

REFERENCELINE Y = y-axis-value | column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 310:

309

Page 320: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph referenceline; begingraph; entrytitle "Line of Symmetry"; layout overlay / yaxisopts=(linearopts=(viewmin=0)); seriesplot x=x y=y; referenceline x=3 / lineattrs=(color=blue) curvelabel="X=3"; endlayout; endgraph; end;run;

data test; do X=0 to 8 by .25; Y=(x-3)*(x-3) + 5; output; end;run;

proc sgrender data=test template=referenceline;run;

Statement SummaryReference lines are always drawn perpendicular to the axes. They are drawn from one axisboundary to the companion boundary (X to X2 or Y to Y2). Axis offsets do not apply toreference lines.

310 Chapter 33 • REFERENCELINE Statement

Page 321: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

A REFERENCELINE statement can be used only within 2-D overlay-type layouts(OVERLAY, OVERLAYEQUATED, or PROTOTYPE). A stand-alone plot statementthat provides a sufficient data range for determining axis extents must be included in thelayout. For example, a REFERENCELINE statement can be used with a scatter plot or ahistogram.

If a column is used to generate multiple reference lines, the column type (numeric or string)must agree with the type of data presented on the axis.

ArgumentsEither the X= or the Y= argument must be used in the REFERENCELINE statement.

X=x-axis-value | column | expressionspecifies the X intercept of the reference line(s).

Requirement: If not specified, then Y must be specified.

By default, if the value specified for the X= argument is outside of the data range, thenthe data range is extended to include the specified intercept. This behavior can bechanged with the CLIP== option

Values must agree in type with the data type of the X axis. For example, you shoulduse numeric SAS date or time values (or SAS date/time constants) for a time axis.

Y=y-axis-value | column | expressionspecifies the Y intercept of the reference line(s).

Requirement: If not specified, then X must be specified.

By default, if the value specified for the Y= argument is outside of the data range, thenthe data range is extended to include the specified intercept. This behavior can bechanged with the CLIP= option.

Values must agree in type with the data type of the Y axis.

Options

Statement Option Description

CLIP Specifies whether the data for the referenceline(s) are considered when determining thedata ranges for the axes.

CURVELABEL Specifies a label for the reference line(s).

CURVELABELATTRS Specifies the color and font attributes of thereference line label(s).

CURVELABELLOCATION Specifies the location of the reference line labelrelative to the plot area.

CURVELABELPOSITION Specifies the position of the reference line labelrelative to the reference line.

DATATRANSPARENCY Specifies the degree of the transparency of thereference line(s).

Example Program and Statement Details 311

Page 322: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

DISCRETEOFFSET Specifies an amount to offset all reference linesfrom discrete X or Y values.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the properties of the reference line(s).

NAME Assigns a name to a plot statement for referencein other template statements.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CLIP=booleanspecifies whether the data for the line are considered when determining the data rangesfor the axes.

Default: FALSE

FALSEThe data for the line contributes to data range for each axis. Each axis might beextended to force the display of the line.

TRUEThe data for the line are ignored when establishing axis scales. Each axis scale isdetermined by the other plots in the layout. This might result in the line not beingdisplayed if its data range is not within the data ranges of the other plots.

CURVELABEL="string" | column | expressionspecifies a label for the reference line(s).

Default: no default

Interaction:

• If the X or Y argument specifies a value, use "string".

• If the X or Y argument specifies a column, use a column to define the label for eachvalue.

The font and color attributes for the label are specified by the CURVELABELATTRS=option.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the reference line label(s). See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: For this option to take effect, the CURVELABEL= option must also beused.

312 Chapter 33 • REFERENCELINE Statement

Page 323: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the reference line label relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the REFERENCELINE is used inmulticell layouts such as LATTICE, DATAPANEL, or DATALATTICE, where axesmight be external to the grid.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the line labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

CURVELABELPOSITION=AUTO | MAX | MINspecifies the position of the reference line label relative to the reference line.

Default: AUTO when CUVELABELLOCATION=OUTSIDE MAX whenCURVELABELLOCATION=INSIDE

AUTOOnly used when CURVELABELLOCATION=OUTSIDE. The line label ispositioned automatically near the line boundary along unused axes wheneverpossible (typically Y2 and X2) to avoid collision with tick values.

MAXForces the line label to appear near maximum line values (typically, the top or right).

MINForces the line label to appear near minimum line values (typically, the bottom orleft).

Restriction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with the CURVELABELLOCATION=option to determine where the line label appears. For more information, see “Locationand Position of Curve Labels” on page 123.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the reference line.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISCRETEOFFSET= numberspecifies an amount to offset all reference lines from X values on a discrete X axis, orfrom Y values on a discrete Y axis.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

Default: 0 (no offset, all reference lines are centered on the X values for a discrete Xaxis, or on the Y values for a discrete Y axis)

Example Program and Statement Details 313

Page 324: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Range: -0.5 to +0.5 where .5 represents half the distance between discrete ticks. Apositive offset is to the right for a vertical reference line and up for a horizontal referenceline. If the layout's axis options set REVERSE=TRUE, then the offset direction is alsoreversed.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the reference line. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default: The GraphReference style element.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Restriction: Another plot that establishes a data range for the axis must be included.

Interaction: This option is ignored if the X= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Restriction: Another plot that establishes a data range for the axis must be included.

Interaction: This option is ignored if the Y= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

314 Chapter 33 • REFERENCELINE Statement

Page 325: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 34

REGRESSIONPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317Regression Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318

Description and SyntaxCreates a fitted regression line or curve computed from input data.

REGRESSIONPLOT X = numeric-column | expressionY = numeric-column | expression </ <regression-options> <option(s)>>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 316:

315

Page 326: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph regressionplot; begingraph; entrytitle "Regression Fit Plot"; layout overlay; scatterplot x=weight y=mpg_highway / datatransparency=.7; regressionplot x=weight y=mpg_highway / name="fitline" alpha=.05 legendlabel="Regression Fit"; discretelegend "fitline"; endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=regressionplot;run;

Statement SummaryThe REGRESSIONPLOT statement only supports models of one independent and onedependent variable. For more information about the fitting methodology, see theTRANSREG procedure in the MISSING Bookref .

In addition to the regression line, the REGRESSIONPLOT statement can computeconfidence levels for the fitted line. To display the confidence levels,

316 Chapter 34 • REGRESSIONPLOT Statement

Page 327: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

1. use the CLI= or CLM= regression option(s) to declare a name for each confidencelevel

2. use MODELBAND statements to refer to the name(s) and draw a confidence band(s)from this information.

Required ArgumentsX=numeric-column | expression

specifies the column for the X values.

Y=numeric-column | expressionspecifies the column for the Y values.

Regression OptionsALPHA= positive-number

specifies the confidence level to compute.

Default: .05

Range: 0 - 1

ALPHA=.05 represents a 95% confidence level.

CLI= "name"produces confidence limits for individual predicted values for each observation. Theconfidence level is set by the ALPHA= option.

Default: no default

Interaction: name is a unique name within the template that is case sensitive and cannotcontain spaces. It must be assigned in order for the confidence limits to be computed.To display confidence limits, you must use this name as the required argument of aMODELBAND statement. See the example in “Example Program and StatementDetails” on page 315.

CLM= "name"produces confidence limits for a mean predicted value for each observation. Theconfidence level is set by the ALPHA= option.

Default: no default

Interaction: name is a unique name within the template that is case sensitive and cannotcontain spaces. It must be assigned in order for the confidence limits to be computed.To display confidence limits, you must use this name as the required argument of aMODELBAND statement. See the example in “Example Program and StatementDetails” on page 315.

DEGREE= non-negative-integerspecifies the degree of the polynomial.

Default: 1

DEGREE=1 produces a linear fit, DEGREE=2 produces a quadratic fit, DEGREE=3produces a cubic fit, and so on.

The value of the DEGREE= d option corresponds to either of the following PROCTRANSREG specifications for the independent variable: SPLINE(X / DEGREE=d) orPBSPLINE(X / DEGREE=d LAMBDA=0).

Example Program and Statement Details 317

Page 328: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

FREQ= numeric-columnspecifies a variable in the input data set that represents the frequency of occurrence ofthe current observation, essentially treating the data set as if each observation appearedn times, where n is the value of the FREQ variable for the observation. Nonintegervalues of the FREQ variable are truncated to the largest integer less than the FREQvalue. The observation is used in the analysis only if the value of the FREQ variable isgreater than or equal to 1.

Default: no default

MAXPOINTS= positive-integerspecifies the maximum number of predicted points generated for the regression curveas well as any confidence limits.

Default: 201

WEIGHT= numeric-columnspecifies a variable in the input data set that contains values to be used as a priori weightsfor a regression fit. If an observation’s weight is zero, negative, or missing, theobservation is deleted from the analysis.

Default: no default

Options

Statement Option Description

CURVELABEL Specifies the label of the regression line.

CURVELABELATTRS Specifies the color and font attributes of theregression line label.

CURVELABELLOCATION Specifies the location of the regression linelabel relative to the plot area.

CURVELABELPOSITION Specifies the position of the regression linelabel relative to the regression line.

DATATRANSPARENCY Specifies the degree of the transparency of theregression line.

GROUP Creates a distinct set of regression lines fromjust the observations that correspond to eachunique group value of the specified column.

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the properties of the regression line.

NAME Assigns a name to a plot statement for referencein other template statements.

318 Chapter 34 • REGRESSIONPLOT Statement

Page 329: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

PRIMARY Specifies that the data columns for this plot beused for determining default axis features.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

CURVELABEL="string"specifies a label for the regression line.

Default: no default

Interaction: If the GROUP= option is specified, this option is ignored.

The font and color attributes for the label are specified by theCURVELABELATTRS= option.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the regression line labels. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: For this option to take effect, the CURVELABEL= option must also beused.

Interaction: If the GROUP= option is specified, this option is ignored.

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the regression line label relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the REGRESSIONPLOT is used inmulti-cell layouts such as LATTICE, DATAPANEL, or DATALATTICE, where axesmight be external to the grid.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the line labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

Example Program and Statement Details 319

Page 330: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

CURVELABELPOSITION=AUTO | MAX | MIN | START | ENDspecifies the position of the regression line label relative to the regression line.

Default: AUTO when CUVELABELLOCATION=OUTSIDE END whenCURVELABELLOCATION=INSIDE

AUTOOnly used when CURVELABELLOCATION=OUTSIDE. The line label ispositioned automatically near the line boundary along unused axes wheneverpossible (typically Y2 and X2) to avoid collision with tick values.

MAXForces the line label to appear near maximum line values (typically, upper right).

MINForces the line label to appear near minimum line values (typically, lower left).

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces the line label toappear near the beginning of the regression line. Particularly useful when the curveline has a spiral shape.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces the line label toappear near the end of the regression line. Particularly useful when the curve linehas a spiral shape.

Restriction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified. The START and END settings arenot supported if CURVELABELLOCATION=OUTSIDE is specified.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with the CURVELABELLOCATION=option to determine where the line label appears. For more information, see “Locationand Position of Curve Labels” on page 123.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the regression line.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

GROUP=column | expressioncreates a distinct set of regression lines from just the observations that correspond toeach unique group value of the specified column.

Default: Each distinct group value might be represented in the graph by a differentcombination of line color and line pattern. Line colors vary according to theGraphData1:ContrastColor - GraphDataN:ContrastColor style references, and linepatterns vary according to the GraphData1:LineStyle - GraphDataN:LineStyle stylereferences.

Restriction: The input data must be sorted by the GROUP= column.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of line colors and line patterns.

The LINEATTRS= option can be used to override the representations that are used toidentify the groups. For example, LINEATTRS=(PATTERN=SOLID) can be used toassign the same pattern to all of the lines, letting the line color distinguish group values.

320 Chapter 34 • REGRESSIONPLOT Statement

Page 331: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Likewise, LINEATTRS=(COLOR=BLACK) can be used to assign the same color toall of the lines, letting the line pattern distinguish group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style element touse.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The string specified on the NAME= option.

Interaction: If the GROUP= option is specified, this option is ignored.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the regression line. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Line Options” onpage 564 for available line-options.

Default: The GraphFit style element.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use ofcolors, marker symbols, and line patterns between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

Example Program and Statement Details 321

Page 332: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of role-name = format pairs separated by blanks.

TIPFORMAT=(Y=6.2)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

The columns assigned to the roles X, Y, and GROUP (if assigned) are automaticallyincluded in the tooltip information.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of role-name = "string" pairs separated by blanks.

TIPLABEL=(Y="Regression Fit")

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

The columns assigned to the roles X, Y, and GROUP (if assigned) are automaticallyincluded in the tooltip information.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

322 Chapter 34 • REGRESSIONPLOT Statement

Page 333: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 35

SCATTERPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

Description and SyntaxCreates a scatter plot of input data.

SCATTERPLOT X = column | expressionY = column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 324:

323

Page 334: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph scatterplot; begingraph; entrytitle "Height and Weight by Sex"; layout overlay; scatterplot x=height y=weight / group=sex name="scatter" datalabel=name; discretelegend "scatter"; endlayout; endgraph; end;run;

proc sgrender data=sashelp.class template=scatterplot;run;

Required ArgumentsX=column | expression

specifies the column for the X values.

Y=column | expressionspecifies the column for the Y values.

324 Chapter 35 • SCATTERPLOT Statement

Page 335: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Options

Statement Option Description

COLORMODEL Specifies a style element to be used with theMARKERCOLORGRADIENT= option.

DATALABEL Specifies a column for marker labels.

DATALABELATTRS Specifies the color and font attributes of the datalabels.

DATATRANSPARENCY Specifies the degree of the transparency of themarkers, data labels, and error bars, whendisplayed.

DISCRETEOFFSET Specifies an amount to offset all markers fromdiscrete X values, or discrete Y values, or both.

ERRORBARATTRS specifies the attributes of any error barsassociated with the data points.

FREQ Specifies a column that indicates a frequencycount for each observation of the input dataobject.

GROUP Creates a separate marker type for each uniquegroup value of the specified column.

INDEX Specifies indices for mapping marker attributes(color and symbol) to one of the GraphData1 -GranphDataN style elements.

MARKERATTRS Specifies the attributes of the data markers.

MARKERCHARACTER Specifies a column that defines strings to beused instead of marker symbols.

MARKERCHARACTERATTRS Specifies the color and font attributes of themarker character specified on theMARKERCHARACTER= option.

MARKERCOLORGRADIENT Specifies the column that is used to map markercolors to a continuous gradient.

NAME Assigns a name to a plot statement for referencein other template statements.

PRIMARY on page 331 Specifies that the data columns for this plot beused for determining default axis features.

REVERSECOLORMODEL Specifies whether to reverse a gradient definedby the COLORMODEL= option.

Example Program and Statement Details 325

Page 336: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

ROLENAME Specifies roles for information defined by datacolumns.

TIP Specifies the information to display when thecursor is positioned over the scatter points.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

URL Specifies an HTML page to display when apoint is selected.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

XERRORLOWER Specifies values for the lower endpoints on theX error bars.

XERRORUPPER Specifies values for the upper endpoints on theX error bars.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

YERRORLOWER Specifies values for the lower endpoints on theY error bars.

YERRORUPPER Specifies values for the upper endpoints on theY error bars.

COLORMODEL=style-elementspecifies a style element to be used with the MARKERCOLORGRADIENT= option.

Default: The ThreeColorAltRamp style element.

style-elementName of a style element. The style element should contain these style attributes:

STARTCOLOR color for the smallest data value of thecolumn that is specified on theMARKERCOLORGRADIENT= option

NEUTRALCOLOR color for the midpoint of the range of thecolumn that is specified on theMARKERCOLORGRADIENT= option

ENDCOLOR color for the highest data value of thecolumn that is specified on theMARKERCOLORGRADIENT= option

Interaction: For this option to take effect, the MARKERCOLORGRADIENT= optionmust also be specified.

326 Chapter 35 • SCATTERPLOT Statement

Page 337: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The REVERSECOLORMODEL= option can be used to reverse the start and end colorsof the ramp assigned to the color model.

DATALABEL=column | expressionspecifies a column for marker labels. The label positions are adjusted to prevent themfrom overlapping.

Default: no default

Interaction: If a numeric column is specified and the column has no format, a BEST6.format is applied.

Interaction: This option is ignored if the MARKERCHARACTER= option is used,which displays labels instead of the markers.

DATALABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the data labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphDataText style element.

• For grouped data, the GraphData1:ContrastColor - GraphDataN:ContrastColorstyle references.

Interaction: For this option to take effect, the DATALABEL= option must also bespecified.

Interaction: This option is ignored if the MARKERCHARACTER= option isspecified.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the markers, data labels, and error bars, whendisplayed.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISCRETEOFFSET=numberspecifies an amount to offset all markers from X values for a discrete X axis, or fromY values for a discrete Y axis. If both axes are discrete, the offset applies to both axes.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

Default: 0 (no offset, all markers are centered on the X values for a discrete X axis, oron the Y values for a discrete Y axis)

Range: -0.5 to +0.5, where .5 represents half the distance between discrete ticks. Apositive offset is to the right on discrete X values and up on discrete Y values. If thelayout’s axis options set REVERSE=TRUE, the offset direction is also reversed.

Example Program and Statement Details 327

Page 338: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Details: This feature is useful for graphing multiple response variables side by side ona common axis. By default within an overlay-type layout, if a SCATTERPLOT is usedwith other plots with a discrete axis, the markers are centered on the discrete X values,or discrete Y values, or both. Depending on the data, the markers might besuperimposed over other graph data. The following code fragment shows the defaultpositioning when a SCATTERPLOT is used with a BOXPLOT:

layout overlay / cycleattrs=true xaxisopts=(type=discrete);

scatterplot x=age y=weight; boxplot x=age y=weight;

endlayout;

To avoid superimposed plots, you can assign a different offset to each plot statement:

layout overlay / cycleattrs=true xaxisopts=(type=discrete); scatterplot x=age y=weight / discreteoffset=0.2; boxplot x=age y=weight / discreteoffset=-0.2;endlayout;

ERRORBARATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the error bars that are associated with the data points. See“General Syntax for Attribute Options” on page 563 for the syntax on using a style-element and “Line Options” on page 564 for available line-options.

Default:

• For non-grouped data, the GraphError style element.

328 Chapter 35 • SCATTERPLOT Statement

Page 339: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• For grouped data, the LineStyle and LineThickness attributes of the GraphErrorstyle element and the ContrastColor attribute of the GraphData1 - GraphDataN styleelements. (The LineStyle does not apply to the "serif" parts of the error bars.)

Interaction: For this option to take effect, error bars must be displayed by theXERRORLOWER=, XERRORUPPER=, YERRORLOWER=, orYERRORUPPER= options.

FREQ=numeric-column | expressionspecifies a column that indicates a frequency count for each observation of the inputdata object. If n is the value of the FREQ variable for a given observation, then thatobservation is plotted n times.

Default: Each observation is plotted once.

Restriction: If the value of the numeric-column is missing or is less than 1, theobservation is not used in the analysis. If the value is not an integer, only the integerportion is used.

GROUP=column | expressioncreates a separate marker type for each unique group value of the specified column.

Default: Each distinct group value might be represented in the graph by a differentcombination of color and marker symbol. Markers vary according to the ContrastColorand MarkerSymbol attributes of the GraphData1 - GraphDataN style elements.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of markers and colors.

Interaction: The marker size is set by the MARKERATTRS= option.

Interaction: If the MARKERCHARACTER= and MARKERCOLORGRADIENT=options are used, their settings override the group settings for marker symbol andmarker color.

Interaction: The representations that are used to identify the groups can be overridden.For example, each distinct group value is represented by a different marker symbol,but the MARKERATTRS= ( SYMBOL= marker ) option could be used to assign thesame symbol to all of the plot’s marker symbols, letting marker color indicate groupvalues. Likewise, MARKERATTRS= ( COLOR= color ) could be used to assign thesame color to all markers, letting marker symbol indicate group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping marker attributes (color and symbol) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: If the MARKERCHARACTER= and MARKERCOLORGRADIENT=options are used, their settings override the group settings for marker symbol andmarker color.

Interaction: The index values are 1-based indices. For the style elements GraphData1- GraphDataN, if the index value is greater than N, then a modulo operation remapsthat index value to a number less than N to determine which style element to use.

Example Program and Statement Details 329

Page 340: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label to be used in a legend.

Default: The Y-variable label. If a label is not defined, the Y-variable name.

Interaction: If the GROUP= option is specified, this option is ignored.

MARKERATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the data markers. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Marker Options” on page565 for available marker-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the MarkerSymbol and ContrastColor attributes of theGraphData1 - GraphDataN style elements, and the GraphDataDefault:MarkerSizestyle reference.

Interaction: If the MARKERCOLORGRADIENT= option is specified, this option’sCOLOR= setting is ignored.

Interaction: If the MARKERCHARACTER= option is specified, its SYMBOL= andWEIGHT= settings are ignored.

MARKERCHARACTER=column | expressionspecifies a column that defines strings to be used instead of marker symbols.

Default: no default

Interaction: This option overrides the DATALABEL= option.

Interaction: If the GROUP= option is also used, color is displayed for a DISCRETElegend, but the character is not displayed in the legend.

If the GROUP= option is also specified, the same colors are applied to the text stringsas would have been applied to markers.

If a numeric column is used, its values are converted to strings using the formatassociated with the column or BEST6. if no format is defined.

Each string is centered horizontally and vertically at the data point. The data pointpositions are not adjusted to prevent text overlap.

MARKERCHARACTERATTRS=style-element | style-element (text-options) | (text-options)

specifies the color and font attributes of the marker character specified on theMARKERCHARACTER= option. See “General Syntax for Attribute Options” on page

330 Chapter 35 • SCATTERPLOT Statement

Page 341: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

563 for the syntax on using a style-element and “Text Options” on page 566 foravailable text-options.

Default:

• For non-grouped data, the GraphDataText style element.

• For grouped data, GraphData1:ContrastColor - GraphDataN:ContrastColor stylereferences.

Interaction: For this option to take effect, the MARKERCHARACTER= option mustalso be used.

When the GROUP= option is also specified, each distinct group value might berepresented by a different color (depending on the ODS style setting or the setting onthe INDEX= option). The marker character that is associated with the group is assignedthe group color. This option’s COLOR= suboption can be used to specify a single colorfor all marker characters in a graph, without affecting items that have the group color,such as error bars and marker symbols.

MARKERCOLORGRADIENT=numeric-column | expressionspecifies the column that is used to map marker colors to a continuous gradient.

Default: no default

Restriction: To display a legend with this option in effect, you must use aCONTINUOUSLEGEND statement, not a DISCRETELEGEND statement.

Interaction: This option overrides the COLOR= setting of the MARKERATTRS= orMARKERCHARACTERATTRS= option.

This option can be used to add a second response variable to an analysis. For example,in an analysis of weight by height, an age column might be specified by theMARKERCOLORGRADIENT= option so that the change in the gradient color of themarkers reflects the change in age.

By default, the color range is determined by the ThreeColorAltRamp style element.The COLORMODEL= option allows a different color range to be used.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use of colorsand marker symbols between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Example Program and Statement Details 331

Page 342: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

REVERSECOLORMODEL=booleanspecifies whether to reverse a gradient (color ramp) defined by theCOLORMODEL= option.

Default: FALSE

ROLENAME=( role-name-list )specifies user-defined roles for information contained in data columns.

Default: no default

(rolename-list)a blank-separated list of rolename = column pairs.

For example, ROLENAME= ( TIP1=OBS ) assigns the column OBS to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X, Y, DATALABEL, MARKERCHARACTER,MARKERCOLORGRADIENT, XERRORLOWER, XERRORUPPER,YERRORLOWER, YERRORUPPER, GROUP, and INDEX.

Interaction: For this option to take effect, the TIP= option must also be used.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

TIP=(role-list)specifies the information to display when the cursor is positioned over the scatter points.If this option is used, it replaces all the information displayed by default. Roles forcolumns that do not contribute to the scatter plot can be specified along with roles thatdo.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X, Y, DATALABEL, MARKERCHARACTER,MARKERCOLORGRADIENT, XERRORLOWER, XERRORUPPER,YERRORLOWER, YERRORUPPER, FREQ, and GROUP.

(role-list)an ordered, blank-separated list of unique SCATTERPLOT and user-defined roles.SCATTERPLOT roles include X on page 324, Y, DATALABEL,MARKERCHARACTER, MARKERCOLORGRADIENT, XERRORLOWER,XERRORUPPER, YERRORLOWER, YERRORUPPER, GROUP, and INDEX.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles X,XERRORUPPER and XERRORLOWER, as well as the column OBS, which is notassigned to any pre-defined ScatterPlot role. The OBS column must first beassigned a role.

ROLENAME=(TIP1=OBS) TIP= (TIP1 X XERRORUPPER XERRORLOWER)

332 Chapter 35 • SCATTERPLOT Statement

Page 343: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

The labels and formats for the TIP variables can be controlled with the TIPLABEL=and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of rolename = format pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X XERRORUPPER XERRORLOWER) TIPFORMAT=(XERRORUPPER=5.3 XERRORLOWER=5.3)

Requirement: Columns must be assigned to the roles for this option to have any effect.See the ROLENAME= option.

This option provides a way to control the formats of columns that appear in tooltips.Only the roles that appear in the TIP= option are used.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of rolename = "string" pairs separated by blanks.

ROLENAME=(TIP1=PCT) TIP=(TIP1 X XERRORUPPER XERRORLOWER) TIPLABEL=(XERRORUPPER="1 STD ERROR" XERRPRLOWER="-1 STD ERROR")

Requirement: Columns must be assigned to the roles for this option to have any effect.See the ROLENAME= option.

This option provides a way to control the labels of columns that appear in tooltips. Onlythe roles that appear in the TIP= option are used.

URL=character-columnspecifies an HTML page to display when a point is selected.

Default: no default

character-columneach value of the column must be a valid HTML page reference (HREF). Forexample, http://www.sas.com/technologies/analytics/index.html.

Requirement: To generate selectable markers, you must include an ODS GRAPHICSON statement that has the IMAGEMAP option specified, and write the graphs to theODS HTML destination.

The URL value can be blank for some X and Y pairs, meaning that no action is takenwhen the corresponding point is selected. The URL value can be the same for any Xand Y pairs. In that case, the same action is taken when the points for those X and Ypairs are selected.

Example Program and Statement Details 333

Page 344: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: This option is ignored if the X= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

XERRORLOWER=numeric-column | expressionspecifies values for the lower endpoints on the X error bars.

Default: The lower segment of the error bars is not drawn.

The values are actual values, not relative values.

The appearance of the error bars is controlled by the ERRORBARATTRS= option.

XERRORUPPER=numeric-column | expressionspecifies values for the upper endpoints on the X error bars.

Default: The upper segment of the error bars is not drawn.

The values are actual values, not relative values.

The appearance of the error bars is controlled by the ERRORBARATTRS= option.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: This option is ignored if the Y= argument is not specified.

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

YERRORLOWER=numeric-column | expressionspecifies values for the lower endpoints on the Y error bars.

Default: The lower segment of the error bars is not drawn.

The values are actual values, not relative values.

The appearance of the error bars is controlled by the ERRORBARATTRS= option.

YERRORUPPER=numeric-column | expressionspecifies values for the upper endpoints on the Y error bars.

Default: The upper segment of the error bars is not drawn.

The values are actual values, not relative values.

The appearance of the error bars is controlled by the ERRORBARATTRS= option.

334 Chapter 35 • SCATTERPLOT Statement

Page 345: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 36

SCATTERPLOTMATRIXStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337

Description and SyntaxCreates a matrix of all pairwise scatter plots of the specified variables.

SCATTERPLOTMATRIX numeric-column-list </option(s)>

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 336:

335

Page 346: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph scatterplotmatrix; begingraph; entrytitle "Scatter Plot Matrix"; layout gridded; scatterplotmatrix sepallength sepalwidth petallength petalwidth / group=species name="matrix"; discretelegend "matrix"; endlayout; endgraph; end;run;

proc sgrender data=sashelp.iris template=scatterplotmatrix;run;

Statement SummaryBy default, the SCATTERPLOTMATRIX statement produces a symmetric scatter plotmatrix. For n columns, it produces an n columns by n rows matrix of scatter plots. Bydefault, the columns of the matrix are in the same left-to-right order as the order of thenumeric-column-list. The rows of the matrix are in the same bottom-to-top order as thenumeric-column-list. You can reverse the direction of the diagonal by settingSTART=TOPLEFT.

To produce a rectangular matrix of scatter plots, use the ROWVARS= option. Specifyingn columns in the SCATTERPLOTMATRIX statement and m columns on the ROWVARS=option produces an n-columns by m-rows matrix of scatter plots. For example, the

336 Chapter 36 • SCATTERPLOTMATRIX Statement

Page 347: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

following statement specifies 2 columns on SCATTERPLOTMATRIX and 3 columns onthe ROWVARS= option to produce the 2-columns by 3-rows matrix:

SCATTERPLOTMATRIX Height Weight / ROWVARS=(Age Height Weight);

The SCATTERPLOTMATRIX statement cannot appear within an overlay-type layout. Itgenerates its own matrix of plots and is typically placed in a LAYOUT GRIDDED block.

If there are missing values in a column or a row, all of the points that can be plotted areplotted in each scatter plot.

Required Argumentsnumeric-column-list

specifies a list of numeric columns to plot. There must be at least two columns toproduce a useful matrix.

The default width is 640px, and the default height is 480px. The graph size is notautomatically adjusted to accommodate a large number of columns.

To change the graph size for the current template, use the DESIGNHEIGHT= andDESIGNWIDTH= options in the BEGINGRAPH statement. To change the graph sizefor all templates in the current SAS session, use the HEIGHT= and WIDTH= optionsin the ODS GRAPHICS statement. Size settings in the ODS GRAPHICS statementoverride size settings in the BEGINGRAPH statement.

You can also limit the number of columns in the matrix (perhaps to seven in eachdimension, for example) so that the resulting graphs are not too small to be useful.

Options

Statement Option Description

COLORMODEL Specifies a style element to be used with theMARKERCOLORGRADIENT= option.

CORROPTS Specifies options for computing measures ofassociation between pairs of variables.

DATALABEL Specifies a column for marker labels.

DATALABELATTRS Specifies the color and font attributes of the datalabels.

DATATRANSPARENCY Specifies the degree of the transparency of themarkers.

DIAGONAL Specifies whether the diagonal cells of thematrix are labeled with the labels (names) of therequired arguments, or with a graph. The graphfor each diagonal cell consists of an overlaycombination of a histogram, normal, or kernelcurves.

Example Program and Statement Details 337

Page 348: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

ELLIPSE Specifies that a confidence ellipse be includedin each cell containing a scatter plot.

FREQ Specifies a column that indicates a frequencycount for each observation of the input dataobject.

GROUP Creates a distinct set of scatter markers, errorbars, and data labels for each unique groupvalue of the specified column.

INDEX Specifies indices for mapping marker attributes(color and symbol) to one of the GraphData1 -GranphDataN style elements.

INSET Specifies what information is displayed in aninset.

INSETOPTS Specifies the location and appearance optionsfor the inset information.

MARKERATTRS Specifies the attributes of the data markers.

MARKERCHARACTER Specifies a column that defines strings to beused instead of marker symbols.

MARKERCHARACTERATTRS Specifies the color and font attributes of themarker character specified on theMARKERCHARACTER= option.

MARKERCOLORGRADIENT Specifies the column that is used to map markercolors to a continuous gradient.

NAME Assigns a name to a plot statement for referencein other template statements.

REVERSECOLORMODEL Specifies whether to reverse a gradient definedby the COLORMODEL= option.

ROLENAME Specifies roles for information defined by datacolumns.

ROWVARS Specifies a secondary list of columns to bepaired with the required column list that isspecified by the SCATTERPLOTMATRIXstatement.

START Specifies whether to start populating the rowsof the matrix from the top left or the bottom leftcorner.

TIP Specifies the information to display when thecursor is positioned over the scatter points.

338 Chapter 36 • SCATTERPLOTMATRIX Statement

Page 349: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

WALLCOLOR Specifies the fill color of the plot wall area.

WALLDISPLAY Specifies whether the plot’s wall and walloutline are displayed.

COLORMODEL=style-elementspecifies a style element to be used with the MARKERCOLORGRADIENT= option.

Default: The ThreeColorAltRamp style element.

style-elementName of a style element. The style element should contain these style attributes:

STARTCOLOR color for the smallest data value of thecolumn that is specified on theMARKERCOLORGRADIENT= option

NEUTRALCOLOR color for the midpoint of the range of thecolumn that is specified on theMARKERCOLORGRADIENT= option

ENDCOLOR color for the highest data value of thecolumn that is specified on theMARKERCOLORGRADIENT= option

Interaction: For this option to take effect, the MARKERCOLORGRADIENT= optionmust also be specified.

Interaction: The REVERSECOLORMODEL= option can be used to reverse the startand end colors of the ramp assigned to the color model.

CORROPTS=(correlation-options)specifies options for computing measures of association between pairs of variables.

The following correlation-options are available:

EXCLNPWGT = FALSE | TRUEspecifies whether observations with non-positive weight values are excluded(TRUE) from the analysis.

Default: FALSE (observations with negative weights are treated like those withzero weights and counted in the total number of observations).

NOMISS = FALSE | TRUEspecifies whether observations with missing values are excluded (TRUE) from theanalysis.

Default: FALSE (correlation statistics are computed using all of the nonmissingpairs of variables).

Using NOMISS=TRUE is computationally more efficient.

Example Program and Statement Details 339

Page 350: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

WEIGHT = numeric-columnspecifies a weighting variable to use in the calculation of Pearson weighted product-moment correlation. The observations with missing weights are excluded from theanalysis.

Default: For observations with non-positive weights, the weights are set to zeroand the observations are included in the analysis.

You can include EXCLNPWGT among the correlation-options to excludeobservations with negative or zero weights from the analysis. If you use thisWEIGHT correlation-option, consider which value of the VARDEF= correlation-option is appropriate.

VARDEF=DF | N | WDF | WEIGHTspecifies the variance divisor in the calculation of variances and covariances.

Default: DF

DF Degrees of Freedom (N - 1)N number of observationsWDF sum of weights minus 1 (WEIGHT - 1)WEIGHT sum of weights

Interaction: This option has effect only when the INSET= option is also used.

See PROC CORR in the Base SAS Procedures Guide: Statistical Procedures forstatistical and computational details of these options.

DATALABEL=columnspecifies a column for marker labels. The label positions are adjusted to prevent thelabels from overlapping.

Default: no default

Interaction: If a numeric column is specified and the column has no format, a BEST6.format is applied.

Interaction: This option is ignored if the MARKERCHARACTER= option is used.

DATALABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the data labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphDataText style element.

• For grouped data, the GraphData1:ContrastColor - GraphDataN:ContrastColorstyle references.

Interaction: For this option to take effect, the DATALABEL= option must also bespecified.

Interaction: This option is ignored if the MARKERCHARACTER= option isspecified.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the markers.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

340 Chapter 36 • SCATTERPLOTMATRIX Statement

Page 351: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DIAGONAL= LABEL | (graph-list)specifies whether the diagonal cells of the matrix are labeled with the labels (names)of the required arguments, or with a graph. The graph for each diagonal cell consistsof an overlay combination of a histogram, normal, or kernel curves.

Default: Variable labels (or names) are displayed in the diagonal cells.

The graph-list can specify one or more of the following:

HISTOGRAMspecifies a histogram

NORMALspecifies a normal density curve

KERNELspecifies a kernel density estimate.

Requirement: When specifying multiple graphs in the graph-list, you must separatethe values with a space. For example, the following specification requests both ahistogram and a normal density curve in each diagonal cell:

DIAGONAL=(HISTOGRAM NORMAL)

Interaction: The computation for HISTOGRAM, NORMAL, and KERNEL is alwayscomputed on all the data for the current variable (including the FREQ= variable, ifused). The GROUP= option is not considered in any of these computations.

Interaction: This option is ignored if the ROWVARS= option is used.

When this option is specified, the labels are drawn around the outside of the matrix,and the matrix axes are dropped.

ELLIPSE=(<ellipse-suboptions>)specifies that a confidence ellipse be included in each cell containing a scatter plot. Theellipse is always drawn behind the scatter points.

The ellipse-suboptions include the following:

TYPE=MEAN | PREDICTEDspecifies the type of ellipse.

Default: MEAN

See also: For statistical details about how the ellipse is calculated, see “ELLIPSEStatement” on page 229.

MEAN specifies a confidence ellipse of the meanPREDICTED specifies a prediction ellipse of the data

ALPHA=positive-numberspecifies the confidence level to compute for each ellipse.

Default: .05

Range: 0 < number < 1

ALPHA=.05 represents a 95% confidence level.

Default: TYPE=MEAN ALPHA=.05 You can set defaults by specifying the optionwithout arguments: ELLIPSE=( ).

Interaction: The ellipse might be clipped by the data range for the scatter points.

Example Program and Statement Details 341

Page 352: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: The ellipse is always computed on all the data for the current pair of Xand Y variables (including the FREQ= variable, if used). The GROUP= option is notconsidered when computed the ellipse.

The display properties of each ellipse are controlled by the style elements:

• The GraphDataDefault element controls the outline and fill properties.

• The GraphEllipse element controls whether the outline, fill, or both are shown.

FREQ= numeric-column | expressionspecifies a column that indicates a frequency count for each observation of the inputdata object. If n is the value of the FREQ variable for a given observation, then thatobservation is plotted n times.

Default: Each observation is plotted once.

Restriction: If the value of the numeric-column is missing or is less than 1, theobservation is not used in the analysis. If the value is not an integer, only the integerportion is used.

GROUP=column | expressioncreates a distinct set of scatter markers, error bars, and data labels for each unique groupvalue of the specified column.

Default: Each distinct group value might be represented in the graph by a differentcombination of color and marker symbol. Markers vary according to the ContrastColorand MarkerSymbol attributes of the GraphData1 - GraphDataN style elements.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of markers and colors.

Interaction: The marker size is set by the MARKERATTRS= option.

Interaction: If the MARKERCHARACTER= and MARKERCOLORGRADIENT=options are used, their settings override the group settings for marker symbol andmarker color.

Interaction: The representations that are used to identify the groups can be overridden.For example, each distinct group value is represented by a different marker symbol,but the MARKERATTRS=(SYMBOL=marker) option could be used to assign thesame symbol to all of the plot’s marker symbols, letting marker color indicate groupvalues. Likewise, MARKERATTRS=(COLOR=color) could be used to assign thesame color to all markers, letting marker symbol indicate group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping marker attributes (color and symbol) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: If the MARKERCHARACTER= and MARKERCOLORGRADIENT=options are used, their settings override the group settings for marker symbol andmarker color.

342 Chapter 36 • SCATTERPLOTMATRIX Statement

Page 353: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: The index values are 1-based indices. For the style elements GraphData1- GraphDataN, if the index value is greater than N, then a modulo operation remapsthat index value to a number less than N to determine which style element to use.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

INSET= (info-options)specifies what information is displayed in an inset. Insets appear in all cells of the matrixexcept the diagonal and are displayed as a small table of name-value pairs.

Default: no default

The following info-options are available:

NOBSTotal number of observations where both the X and Y variables have nonmissingvalues. If the FREQ= option is used, this number is adjusted accordingly. The valueof NOBS can be further adjusted by the use of the NOMISS=, WEIGHT=, andEXCLNPWGT= suboptions of the CORROPTS= option.

PEARSONThe Pearson product-moment correlation. The computation of the correlation isaffected by the FREQ= and CORROPTS= options. The computation is not doneon a per group value when GROUP= is used.

PEARSONPVALThe probability value for the Pearson product-moment correlation.

The location and appearance of the inset is controlled by the INSETOPTS= option.

Discussion: A typical inset looks like this:

N 150 r 0.96287 p(r) <.0001

In this example,

NOBSis represented by N

PEARSONis represented by r

PEARSONPVALis represented by p(r)

See PROC CORR in the Base SAS Procedures Guide: Statistical Procedures forstatistical and computational details.

INSETOPTS = (appearance-options)specifies location and appearance options for the inset information.

The appearance-options can be any one or more of the settings that follow. The optionsmust be enclosed in parentheses, and each option is specified as a name = value pair.

AUTOALIGN=NONE | AUTO | (location-list)specifies whether the inset is automatically aligned within the layout.

Default: NONE

NONE Do not automatically align the inset. Theinset’s position is therefore set by the

Example Program and Statement Details 343

Page 354: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

HALIGN= and VALIGN= appearance-options.

AUTO Attempt to center this inset in the area thatis farthest from any surrounding markers.Data cells might have different insetplacements.

(location-list) Restrict this inset’s possible locations tothose locations in the specified location-list, and use the location-list position thatleast collides with the data cell’s othergraphics features. The location-list isblank-separated and can contain any ofthese locations: TOPLEFT TOPTOPRIGHT LEFT CENTER RIGHTBOTTOMLEFT BOTTOMBOTTOMRIGHT. Example:AUTOALIGN = (TOPRIGHTTOPLEFT)

Interaction: When AUTOALIGN=AUTO or (location-list), the enclosing layoutstatement’s HALIGN= and VALIGN= appearance-options are ignored.

BACKGROUNDCOLOR= style-reference | colorspecifies the color of the inset background

Default: GraphWalls:Color style reference

style-reference A reference of the form style-element :style-attribute. Only the style-attributenamed COLOR is used.

BORDER= booleanspecifies whether a border is displayed around the inset.

Default: FALSE

HALIGN=LEFT | CENTER | RIGHTspecifies the horizontal alignment of the inset.

Default: LEFT

Interaction: This option is ignored unless AUTOALIGN=NONE.

OPAQUE= booleanspecifies whether the inset background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

TEXTATTRS=style-element | style-element (text-options) | (text-options)specifies the text properties of the entire inset. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options”on page 566 for available text-options.

Default: The GraphDataText style element.

VALIGN=TOP | CENTER |BOTTOMspecifies the vertical alignment of the inset.

Default: TOP

Interaction: This option is ignored unless AUTOALIGN=NONE.

344 Chapter 36 • SCATTERPLOTMATRIX Statement

Page 355: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

MARKERATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the data markers. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Marker Options” on page565 for available marker-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the MarkerSymbol and ContrastColor attributes of theGraphData1 - GraphDataN style elements, and the GraphDataDefault:MarkerSizestyle reference.

Interaction: If the MARKERCOLORGRADIENT= option is specified, this option’sCOLOR= setting is ignored.

Interaction: If the MARKERCHARACTER= option is specified, its SYMBOL= andWEIGHT= settings are ignored.

MARKERCHARACTER=column | expressionspecifies a column that defines strings to be used instead of marker symbols.

Default: no default

Interaction: This option overrides the DATALABEL= option.

Interaction: If the GROUP= option is also used, color is displayed for a DISCRETElegend, but the character is not displayed in the legend.

If the GROUP= option is also specified, the same colors are applied to the text stringsas would have been applied to markers.

If a numeric column is used, its values are converted to strings using the formatassociated with the column or BEST6. if no format is defined.

Each string is centered horizontally and vertically at the data point. The data pointpositions are not adjusted to prevent text overlap.

MARKERCHARACTERATTRS=style-element | style-element (text-options) | (text-options)

specifies the color and font attributes of the marker characters. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphDataText style element.

• For grouped data, GraphData1:ContrastColor - GraphDataN:ContrastColor stylereferences.

Interaction: For this option to take effect, the MARKERCHARACTER= option mustalso be used.

Example Program and Statement Details 345

Page 356: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

When the GROUP= option is also specified, each distinct group value might berepresented by a different color (depending on the ODS style setting or the setting onthe INDEX= option). The marker character that is associated with the group is assignedthe group color. This option’s COLOR= suboption can be used to specify a single colorfor all marker characters in a graph, without affecting items that have the group color,such as error bars and marker symbols.

MARKERCOLORGRADIENT=numeric-column | expressionspecifies the column that is used to map marker colors to a continuous gradient.

Default: no default

Restriction: To display a legend with this option in effect, you must use aCONTINUOUSLEGEND statement, not a DISCRETELEGEND statement.

Interaction: This option overrides the COLOR= setting of the MARKERATTRS= orMARKERCHARACTERATTRS= option.

This option can be used to add a second response variable to an analysis. For example,in an analysis of weight by height, an age column might be specified by theMARKERCOLORGRADIENT= option so that the change in the gradient color of themarkers reflects the change in age.

By default, the color range is determined by the ThreeColorAltRamp style element.The COLORMODEL= option allows a different color range to be used.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use of colorsand marker symbols between the graph and the legend.

REVERSECOLORMODEL=booleanspecifies whether to reverse a gradient (color ramp) defined by theCOLORMODEL= option.

Default: FALSE

ROLENAME=(role-name-list)specifies user-defined roles for information contained in data columns.

Default: no default

(role-name-list)a blank-separated list of rolename = column pairs.

The following example assigns column ID to the user-defined role TIP1, andcolumns AGE, HEIGHT, WEIGHT to the user-defined roles TIP2, TIP3, and TIP4.

346 Chapter 36 • SCATTERPLOTMATRIX Statement

Page 357: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ROLENAME=(TIP1=ID TIP2=AGE TIP3=HEIGHT TIP4=WEIGHT)

Requirement: The role names that you choose must be unique and different from thepre-defined roles X, Y, DATALABEL, MARKERCHARACTER,MARKERCOLORGRADIENT, GROUP, and INDEX.

Interaction: For this option to take effect, the TIP= option must also be used.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

ROWVARS = (column-list)specifies a secondary list of columns to be paired with the required column list that isspecified by the SCATTERPLOTMATRIX statement.

Default: no default

Interaction: When this option is specified, the DIAGONAL= option is ignored.

The labels for the variables appear vertically on the left side of the matrix.

START=TOPLEFT | BOTTOMLEFTspecifies whether to start populating the matrix from the top left or bottom left corner.

Default: TOPLEFT

TIP=(role-list)specifies the information to display when the cursor is positioned over the scatter points.If this option is used, it replaces all the information displayed by default. Roles forcolumns that do not contribute to the scatter plot can be specified along with roles thatdo.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: current X, current Y, DATALABEL, MARKERCHARACTER,MARKERCOLORGRADIENT, and GROUP.

(role-list)an ordered, blank-separated list of unique SCATTERPLOTMATRIX and user-defined roles. SCATTERPLOT roles include: X, Y, GROUP, DATALABEL,MARKERCHARACTER, and MARKERCOLORGRADIENT.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles TIP1,TIP2, TIP3, and TIP4.

ROLENAME=(TIP1=ID TIP2=AGE TIP3=HEIGHT TIP4=WEIGHT)TIP= (TIP1 TIP2 TIP3 TIP4)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of rolename = format pairs separated by blanks.

Example Program and Statement Details 347

Page 358: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ROLENAME=(TIP1=ID TIP2=AGE TIP3=HEIGHT TIP4=WEIGHT)TIP=(TIP1 TIP2 TIP3 TIP4)TIPFORMAT=(TIP3= 4.1)

Requirement: Columns must be assigned to the roles for this option to have any effect.See the ROLENAME= option.

This option provides a way to control the formats of columns that appear in tooltips.Only the roles that appear in the TIP= option are used.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of rolename = "string" pairs separated by blanks.

ROLENAME=(TIP1=ID TIP2=AGE TIP3=HEIGHT TIP4=WEIGHT) TIP=(TIP1 TIP2 TIP3 TIP4)TIPLABEL=(TIP3="Height in Inches"TIP4="Weight in Pounds")

Requirement: Columns must be assigned to the roles for this option to have any effect.See the ROLENAME= option.

This option provides a way to control the labels of columns that appear in tooltips. Onlythe roles that appear in the TIP= option are used.

WALLCOLOR=style-reference | colorspecifies the fill color of the plot wall area.

Default: The GraphWalls:Color style reference.

style-referenceA reference in the form style-element:style-attribute. Only the style- attributenamed COLOR is used.

Interaction: This option is ignored if WALLDISPLAY=NONE orWALLDISPLAY=(OUTLINE).

WALLDISPLAY=STANDARD | ALL | NONE | (display-options)specifies whether the plot’s wall and wall outline are displayed.

Default: STANDARD

STANDARDDisplays a filled wall. The setting of the FRAMEBORDER= ON | OFF attributeof the GraphWalls style element determines whether the wall outline is displayed.

ALLDisplays a filled, outlined wall.

NONEDisplays no wall, no wall outline.

(display-options)These options must include one of the following:

348 Chapter 36 • SCATTERPLOTMATRIX Statement

Page 359: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OUTLINE displays the wall outline.FILL displays a filled wall area.

Use the WALLCOLOR= option to control the fill color of the wall.

The appearance attributes of the wall outline are set by the GraphAxisLine styleelement.

Example Program and Statement Details 349

Page 360: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

350 Chapter 36 • SCATTERPLOTMATRIX Statement

Page 361: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 37

SERIESPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353

Description and SyntaxDisplays a series of line segments that connect observations of input data.

SERIESPLOT X = column | expressionY = column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 352:

351

Page 362: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph seriesplot; begingraph; entrytitle "Tech Stock Trends"; layout overlay; seriesplot x=date y=close / group=stock name="stocks"; discretelegend "stocks"; endlayout; endgraph; end;run;

proc sgrender data=sashelp.stocks template=seriesplot; where date > "31dec1999"d;run;

Statement SummaryThe SERIESPLOT statement is typically used to show time-dependent data.

Required ArgumentsX=column | expression

specifies the column for the X values.

Y=column | expressionspecifies the column for the Y values.

352 Chapter 37 • SERIESPLOT Statement

Page 363: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Options

Statement Option Description

BREAK Breaks the plot line at the occurrences of themissing values of the X or Y variable.

CONNECTORDER Specifies how to connect the data points to formthe series line.

CURVELABEL Specifies a label for the series line.

CURVELABELATTRS Specifies the color and font attributes of theseries line label.

CURVELABELLOCATION Specifies the location of the series line labelrelative to the plot area.

CURVELABELPOSITION Specifies the position of the series label relativeto the series line.

DATALABEL Specifies a column that supplies values for thedata point labels.

DATALABELATTRS Specifies the color and font attributes of the datalabels.

DATATRANSPARENCY Specifies the degree of the transparency of theline and markers, when displayed.

DISCRETEOFFSET Specifies an amount to offset all series lines andmarkers from discrete X values, or discrete Yvalues, or both.

DISPLAY Specifies additional feature to display with theseries line.

GROUP Creates a separate series plot for each uniquegroup value of the specified column.

INDEX Specifies indices for mapping series-lineattributes (color, marker symbol, and linepattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies a label to be used in a legend.

LINEATTRS Specifies the line attributes of the series line.

MARKERATTRS Specifies the attributes of the data markers.

NAME Assigns a name to a plot statement for referencein other template statements.

Example Program and Statement Details 353

Page 364: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

PRIMARY Specifies that the data columns for this plot beused for determining default axis features.

ROLENAME Specifies roles for information defined by datacolumns.

TIP Specifies the information to display when thecursor is positioned over the series line.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

URL Specifies an HTML page to display when aseries line segment is selected.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

BREAK=booleanbreaks the plot line at missing values of the X or Y variable.

Default: FALSE

When this option is set to FALSE, missing values are skipped and a continuous line isdrawn.

CONNECTORDER=XVALUES | XAXISspecifies how to connect the data points to form the series line.

Default: XVALUES

XVALUESConnects data points in the order read from the X variable.

XAXISConnects data points as they occur min-to-max along the X axis.

For certain types of series lines (for example, time series) when the input data mightnot be sorted by the X variable, set this option to XAXIS to assure the expected connectorder.

CURVELABEL="string" | column | expressionspecifies a label for the series line.

Default: no default

Interaction:

• For non-grouped data, use "string".

• For grouped data, use a column to define the labels for each group value.

354 Chapter 37 • SERIESPLOT Statement

Page 365: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The font and color attributes for the label are specified by the CURVELABELATTRS=option.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the series line labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphValueText style element.

• For grouped data, text color is derived from the GraphData1:ContrastColor -GraphDataN:ContrastColor style references. The font is derived from theGraphValueText style element.

Interaction: For this option to take effect, the CURVELABEL=curvelabel option mustalso be used.

Interaction: This option’s COLOR= setting overrides the colors indicated by theGROUP= option.

When the GROUP= option is used, each distinct group value might be represented bya different color. The series label that is associated with the group is assigned the groupcolor. This option can be used to specify a single color for all series labels in a graph,without affecting items that have the group color, such as lines and marker symbols.

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the series line label relative to the plot area.

Default: INSIDE

INSIDEinside the plot area

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the SERIESPLOT is used in multicelllayouts such as LATTICE, DATAPANEL, or DATALATTICE, where axes might beexternal to the grid.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the curve labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

CURVELABELPOSITION=AUTO | MAX | MIN | START | ENDspecifies the position of the series label relative to the series line.

Default: AUTO when CURVELABELLOCATION=OUTSIDE END whenCURVELABELLOCATION=INSIDE

AUTOOnly used when CURVELABELLOCATION=OUTSIDE. The series label ispositioned automatically near the end series line along unused axes wheneverpossible (typically Y2 or X2) to avoid collision with tick values.

MAXForces the series label to appear near maximum series values (typically, to the right)

MINForces the series label to appear near minimum series values (typically, to the left)

Example Program and Statement Details 355

Page 366: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces the series label toappear near the beginning of the curve. Particularly useful when the curve line hasa spiral shape.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces the series label toappear near the end of the curve. Particularly useful when the curve line has a spiralshape.

Restriction: The AUTO setting is not supported ifCURVELABELLOCATION=INSIDE is specified. The START and END settings arenot supported if CURVELABELLOCATION=OUTSIDE is specified.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELLOCATION= option to determine where the series label appears. Formore information, see “Location and Position of Curve Labels” on page 123.

DATALABEL=column | expressionspecifies a column that supplies values for the data point labels.

Default: no default

The label positions are adjusted to prevent the labels from overlapping.

DATALABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the data labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphDataText style element.

• For grouped data, the GraphData1:ContrastColor - GraphDataN:ContrastColorstyle references.

Interaction: For this option to take effect, the DATALABEL= option must also bespecified.

Interaction: This option’s COLOR= setting overrides the colors indicated by theGROUP= option.

When the GROUP= option is used, each distinct group value might be represented bya different color. The data label that is associated with the group is assigned the groupcolor. This option can be used to specify a single color for all data labels in a graph,without affecting items that have the group color, such as error bars and markersymbols.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the line and markers, when displayed.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISCRETEOFFSET=numberspecifies an amount to offset all series lines and markers from X values for a discreteX axis, or from Y values for a discrete Y axis. If both axes are discrete, the offset appliesto both axes.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

356 Chapter 37 • SERIESPLOT Statement

Page 367: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: 0 (no offset, all series lines and markers are centered on the X values for adiscrete X axis, or on the Y values for a discrete Y axis)

Range: -0.5 to +0.5, where .5 represents half the distance between discrete ticks. Apositive offset is to the right on discrete X values and up on discrete Y values. If thelayout’s axis options set REVERSE=TRUE, then the offset direction is also reversed.

DISPLAY=STANDARD | ALL | display-optionsspecifies additional feature to display with the series line.

Default: STANDARD

STANDARDdisplays a series line without markers.

ALLdisplays a series line with markers.

(display-options)a list of options enclosed in parentheses. Currently, only the following option isavailable for the list:

MARKERS—displays a series line with markers

Use the MARKERATTRS= and LINEATTRS= options to control the appearance ofthe line and markers.

GROUP=column | expressioncreates a separate series plot for each unique group value of the specified column.

Default: Each distinct group value might be represented in the graph by a differentcombination of color, line pattern, and marker symbol. Lines and markers varyaccording to the ContrastColor, LineStyle, and MarkerSymbol attributes of theGraphData1 - GraphDataN style elements. Line thickness (for grouped and ungroupeddata) is controlled by the LINEATTRS= option.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of marker symbols, colors, andline patterns.

Interaction: The marker size is set by the MARKERATTRS= option.

The representations that are used to identify the groups can be overridden. For example,each distinct group value is often represented by a different line pattern, but theLINEATTRS= ( PATTERN=pattern ) option could be used to assign the same linepattern to all of the plot’s line patterns, letting line color indicate group values.Likewise, LINEATTRS= ( COLOR= color ) could be used to assign the same color toall lines, letting line pattern indicate group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping series-line attributes (color, marker symbol, and linepattern) to one of the GraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operation

Example Program and Statement Details 357

Page 368: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

remaps that index value to a number less than N to determine which style element touse.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"specifies a label to be used in a legend.

Default: The Y-variable label. If a label is not defined, the Y-variable name.

Interaction: If the GROUP= option is specified, this option is ignored.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the series line. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Line Options” on page564 for available line-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the ContrastColor and LineStyle attributes of the GraphData1 -GraphDataN style elements, and the GraphDataDefault:LineThickness stylereference.

MARKERATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the data markers. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Marker Options” on page565 for available marker-options.

Default:

• For non-grouped data, GraphDataDefault style element.

• For grouped data, the MarkerSymbol and ContrastColor attributes of theGraphData1 - GraphDataN style elements, and the GraphDataDefault:MarkerSizestyle reference.

Interaction: DISPLAY=ALL or DISPLAY=(MARKERS) must be set for this optionto have any effect.

Interaction: This option’s COLOR= suboption overrides the default behavior forgrouped data: all markers the same color and the marker symbol alone distinguishesthe markers.

Interaction: This option’s SYMBOL= suboption overrides the default behavior forgrouped data: it holds the marker constant across group values and marker color alonedistinguishes the markers.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use ofcolors, marker symbols, and line patterns between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

358 Chapter 37 • SERIESPLOT Statement

Page 369: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

ROLENAME=( role-name-list )specifies user-defined roles for information contained in data columns.

Default: no default

(role-name-list)a blank-separated list of rolename = column pairs.

For example, ROLENAME= ( TIP1=OBS ) assigns the column OBS to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X, Y, CURVELABEL, DATALABEL, GROUP, and INDEX.

Interaction: For this option to take effect, the TIP= option must also be used.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

TIP=(role-list)specifies the information to display when the cursor is positioned over the series line.If this option is used, it replaces all the information displayed by default. Roles forcolumns that do not contribute to the series plot can be specified along with roles thatdo.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X, Y, DATALABEL, and GROUP.

(role-list)an ordered, blank-separated list of unique SERIESPLOT and user-defined roles.SERIESPLOT roles include X, Y, CURVELABEL, DATALABEL, and GROUP.

Note: CURVELABEL is considered a role only when it is assigned a column ofvalues. It is not considered a role and does not display tooltips when assigneda string.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles Xand Y as well as the column OBS, which is not assigned to any pre-definedSeriesPlot role. The OBS column must first be assigned a role.

ROLENAME=(TIP1=OBS) TIP= (TIP1 X Y)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Example Program and Statement Details 359

Page 370: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of rolename = format pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X Y) TIPFORMAT=(TIP1=4.)

Requirement: This option provides a way to control the formats of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

TIPLABEL=(role-label-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of rolename = "string" pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X Y) TIPLABEL=(TIP1="Observation #")

Requirement: This option provides a way to control the labels of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

URL=character-columnspecifies an HTML page to display when a point or a segment of the curve is selected.

Default: no default

character-columneach value of the column must be a valid HTML page reference (HREF). Forexample, http://www.sas.com/technologies/analytics/index.html.

Requirement: To generate selectable bars, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

360 Chapter 37 • SERIESPLOT Statement

Page 371: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 38

STEPPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364

Description and SyntaxDisplays a series of horizontal and vertical line segments that connect observations of inputdata.

STEPPLOT X = column | expressionY = numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 362:

361

Page 372: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph stepplot; begingraph; entrytitle "Kaplan-Meier Survival Plot"; layout overlay / yaxisopts=(linearopts=(viewmin=0 viewmax=1)); stepplot x=Time y=Survival / group=Stratum name="step"; scatterplot x=Time y=Censored / name="scat" legendlabel="Censored" markerattrs=(symbol=plus); discretelegend "step" / location=inside halign=right valign=top across=1; discretelegend "scat" / location=inside halign=center valign=top; endlayout; endgraph; end;run;

data Study;input Group : $10. Time Status @@;label Time="Time (Days)";datalines;

... [datalines shown below]

run;

ods graphics;

362 Chapter 38 • STEPPLOT Statement

Page 373: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ods exclude all;ods output survivalplot=plotdata;proc lifetest data=Study plots=(survival); time Time * Status(0); survival; strata Group;run;ods select all;

proc sgrender data=plotdata template=stepplot;run;

Here are the data lines for the example program:

Low-Risk 2569 0 Low-Risk 2506 0 Low-Risk 2409 0Low-Risk 2218 0 Low-Risk 1857 0 Low-Risk 1829 0Low-Risk 1562 0 Low-Risk 1470 0 Low-Risk 1363 0Low-Risk 1030 0 Low-Risk 860 0 Low-Risk 1258 0Low-Risk 2246 0 Low-Risk 1870 0 Low-Risk 1799 0Low-Risk 1709 0 Low-Risk 1674 0 Low-Risk 1568 0Low-Risk 1527 0 Low-Risk 1324 0 Low-Risk 957 0Low-Risk 932 0 Low-Risk 847 0 Low-Risk 848 0Low-Risk 1850 0 Low-Risk 1843 0 Low-Risk 1535 0Low-Risk 1447 0 Low-Risk 1384 0 Low-Risk 414 1Low-Risk 2204 1 Low-Risk 1063 1 Low-Risk 481 1Low-Risk 105 1 Low-Risk 641 1 Low-Risk 390 1Low-Risk 288 1 Low-Risk 421 1 Low-Risk 79 1Low-Risk 748 1 Low-Risk 486 1 Low-Risk 48 1Low-Risk 272 1 Low-Risk 1074 1 Low-Risk 381 1Low-Risk 10 1 Low-Risk 53 1 Low-Risk 80 1Low-Risk 35 1 Low-Risk 248 1 Low-Risk 704 1Low-Risk 211 1 Low-Risk 219 1 Low-Risk 606 1High-Risk 2640 0 High-Risk 2430 0 High-Risk 2252 0High-Risk 2140 0 High-Risk 2133 0 High-Risk 1238 0High-Risk 1631 0 High-Risk 2024 0 High-Risk 1345 0High-Risk 1136 0 High-Risk 845 0 High-Risk 422 1High-Risk 162 1 High-Risk 84 1 High-Risk 100 1High-Risk 2 1 High-Risk 47 1 High-Risk 242 1High-Risk 456 1 High-Risk 268 1 High-Risk 318 1High-Risk 32 1 High-Risk 467 1 High-Risk 47 1High-Risk 390 1 High-Risk 183 1 High-Risk 105 1High-Risk 115 1 High-Risk 164 1 High-Risk 93 1High-Risk 120 1 High-Risk 80 1 High-Risk 677 1High-Risk 64 1 High-Risk 168 1 High-Risk 74 1High-Risk 16 1 High-Risk 157 1 High-Risk 625 1High-Risk 48 1 High-Risk 273 1 High-Risk 63 1High-Risk 76 1 High-Risk 113 1 High-Risk 363 1

Statement SummaryFor character columns, the X-axis is always of TYPE=DISCRETE. For numeric columns,both the X- and the Y-axis are of TYPE=LINEAR by default.

You can change the axis type for numeric axes with the XAXISOPTS= and YAXISOPTS=options of the containing overlay layout.

Example Program and Statement Details 363

Page 374: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The STEPPLOT statement uses X values in data order, unless the CONNECTORDER=option is used to change the order.

Required ArgumentsX=column | expression

specifies the column of the X values.

Y=numeric-column | expressionspecifies the numeric column of the Y values.

Options

Statement Option Description

BREAK Breaks the plot line at the occurrences of themissing values of the Y variable.

CONNECTORDER Specifies how to connect the data points to formthe step line.

CURVELABEL Specifies a label for the step line.

CURVELABELATTRS Specifies the color and font attributes of the stepline label.

CURVELABELLOCATION Specifies the location of the step label relativeto the plot area.

CURVELABELPOSITION Specifies the position of the step line labelsrelative to the step line.

DATALABEL Specifies a column that supplies values for thedata point labels.

DATALABELATTRS Specifies the color and font attributes of the datalabels.

DATATRANSPARENCY Specifies the degree of the transparency of thestep lines, markers, and error bars, whendisplayed.

DISCRETEOFFSET Specifies an amount to offset all step lines andmarkers from discrete X values.

DISPLAY Specifies whether to display markers on the stepline.

ERRORBARATTRS Specifies the attributes of the error bars that areassociated with the data points.

ERRORLOWER Specifies the values of the lower endpoints onthe Y error bars.

364 Chapter 38 • STEPPLOT Statement

Page 375: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

ERRORUPPER Specifies the values of the upper endpoints ofthe Y error bars.

GROUP Creates a separate step plot for each uniquegroup value of the specified column.

INDEX Specifies indices for mapping step-lineattributes (color, marker symbol, and linepattern) to one of the GraphData1 -GranphDataN style elements.

JOIN Specifies whether the steps are connected.

JUSTIFY Specifies the location of the data point relativeto the step.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the line attributes of the step line.

MARKERATTRS Specifies the attributes of the data markers.

NAME Assigns a name to a plot statement for referencein other template statements.

PRIMARY Specifies that the data columns for this plot beused for determining default axis features.

ROLENAME Specifies roles for information defined by datacolumns.

TIP Specifies the information to display when thecursor is positioned over the step line.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

URL Specifies an HTML page to display when aseries line segment is selected.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

Example Program and Statement Details 365

Page 376: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

BREAK=booleandetermines whether the plot line should show breaks at occurrences of missing valuesof the Y variable.

Default: FALSE

When this option is set to FALSE, missing values are skipped and the line continuesthrough the missing value and to the next point.

CONNECTORDER=XVALUES | XAXISspecifies how to connect the data points to form the step line.

Default: XVALUES

XVALUESConnects data points in the data order of the X variable.

XAXISConnects data points sorted by their X values.

When the input data for the step lines is not sorted by the X variable, set this option toXAXIS to assure the expected connect order.

CURVELABEL="string" | column | expressionspecifies a label for the step line.

Default: no default

Interaction:

• For non-grouped data, use "string".

• For grouped data, use a column to define the labels for each group value.

The font and color attributes for the label are specified by the CURVELABELATTRS=option.

CURVELABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the step line labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphValueText style element.

• For grouped data, text color is derived from the GraphData1:ContrastColor -GraphDataN:ContrastColor style references. The font is derived from theGraphValueText style element.

Interaction: For this option to take effect, the CURVELABEL= option must also beused.

Interaction: This option’s COLOR= setting overrides the colors indicated by theGROUP= option.

When the GROUP= option is used, each distinct group value might be represented bya different color. The series label that is associated with the group is assigned the groupcolor. This option can be used to specify a single color for all series labels in a graph,without affecting items that have the group color, such as lines and marker symbols.

CURVELABELLOCATION=INSIDE | OUTSIDEspecifies the location of the step label relative to the plot area.

Default: INSIDE

366 Chapter 38 • STEPPLOT Statement

Page 377: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

INSIDEinside the plot area

OUTSIDEoutside the plot area

Restriction: OUTSIDE cannot be used when the STEPPLOT is used in multicelllayouts such as LATTICE, DATAPANEL, or DATALATTICE, where axes areexternal to the grid.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELPOSITION= option to determine where the curve labels appear. Formore information, see “Location and Position of Curve Labels” on page 123.

CURVELABELPOSITION=AUTO | MAX | MIN | START | ENDspecifies the position of the step line labels relative to the step line.

Default: AUTO when CUVELABELLOCATION=OUTSIDE END whenCURVELABELLOCATION=INSIDE

AUTOOnly used when CURVELABELPOSITION=OUTSIDE. The step label ispositioned automatically near the step boundary along unused axes wheneverpossible (typically Y2 and X2) to avoid collision with tick values.

MAXForces the step label to appear near maximum step values (typically, upper right)

MINForces the step label to appear near minimum step values (typically, lower left)

STARTOnly used when CURVELABELLOCATION=INSIDE. Forces the step label toappear near the beginning of the steps. Particularly useful when the step line“spirals” around.

ENDOnly used when CURVELABELLOCATION=INSIDE. Forces the step label toappear near the end of the steps. Particularly useful when the step line “spirals”around.

Restriction: The AUTO setting is not supported if CURVELABELLOCATION=INSIDE is specified. The START and END settings are not supported ifCURVELABELLOCATION=OUTSIDE is specified.

Interaction: For this option to take effect, the CURVELABEL= option must also bespecified.

Interaction: This option is used in conjunction with theCURVELABELLOCATION= option to determine where the series label appears. Formore information, see “Location and Position of Curve Labels” on page 123.

DATALABEL=column | expressionspecifies a column that supplies values for the data point labels.

Default: no default

The label positions are adjusted to prevent the labels from overlapping.

Example Program and Statement Details 367

Page 378: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DATALABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the data labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphDataText style element.

• For grouped data, the GraphData1:ContrastColor - GraphDataN:ContrastColorstyle references.

Interaction: For this option to take effect, the DATALABEL= option must also bespecified.

Interaction: This option’s COLOR= setting overrides the colors indicated by theGROUP= option.

When the GROUP= option is used, each distinct group value might be represented bya different color. The data label that is associated with the group is assigned the groupcolor. This option can be used to specify a single color for all data labels in a graph,without affecting items that have the group color, such as error bars and markersymbols.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the step lines, markers, and error bars, whendisplayed.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

DISCRETEOFFSET=numberspecifies an amount to offset all step lines and markers from the X values for a discreteX axis.

Note: This feature is for the third maintenance release of SAS 9.2 and later.

Default: 0 (no offset, all step lines and markers are centered on the discrete X values)

Range: -0.5 to +0.5, where .5 represents half the distance between discrete ticks. Apositive offset is to the right. If the layout’s axis options set REVERSE=TRUE, thenthe offset direction is also reversed.

DISPLAY=STANDARD | ALL | (display-options)specifies whether to display markers on the step line.

Default: STANDARD

STANDARDdisplays a step line without markers.

ALLdisplays a step line with markers.

(display-options)a list of options enclosed in parentheses. Currently, only the following option isavailable for the list:

MARKERS—displays a step line with markers

Use the MARKERATTRS= and LINEATTRS= options to control the appearance ofthe line and markers.

368 Chapter 38 • STEPPLOT Statement

Page 379: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ERRORBARATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the error bars that are associated with the data points. See“General Syntax for Attribute Options” on page 563 for the syntax on using a style-element and “Line Options” on page 564 for available line-options.

Default:

• For non-grouped data, the GraphError style element.

• For grouped data, the LineStyle and LineThickness attributes of the GraphErrorstyle element and the ContrastColor attribute of the GraphData1 - GraphDataN styleelements. (The LineStyle does not apply to the "serif" parts of the error bars.)

Interaction: For this option to take effect, error bars must be displayed by theERRORLOWER= or ERRORUPPER= options.

ERRORLOWER=numeric-column | expressionspecifies the values of the lower endpoints on the Y error bars.

Default: The lower segment of the error bars is not drawn.

Interaction: If the GROUP= option is specified, this option is ignored.

The error bar values must be absolute data values, not data values relative to the valueof the bar.

The appearance of the error bars is controlled by the ERRORBARATTRS= option.

ERRORUPPER=numeric-column | expressionspecifies the values of the upper endpoints on the Y error bars.

Default: The upper segment of the error bars is not drawn.

Interaction: If the GROUP= option is specified, this option is ignored.

The error bar values must be absolute data values, not data values relative to the valueof the bar.

The appearance of the error bars is controlled by the ERRORBARATTRS= option.

GROUP=column | expressioncreates a distinct set of lines, markers, and data labels for each unique group value ofthe specified column.

Default: Each distinct group value might be represented in the graph by a differentcombination of color, line pattern, and marker symbol. Lines and markers varyaccording to the ContrastColor, LineStyle, and MarkerSymbol attributes of theGraphData1 - GraphDataN style elements. Line thickness (for grouped and ungroupeddata) is controlled by the LINEATTRS= option.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of marker symbols, colors, andline patterns.

Interaction: The marker size is set by the MARKERATTRS= option.

The representations that are used to identify the groups can be overridden. For example,each distinct group value is often represented by a different line pattern, but theLINEATTRS= ( PATTERN=pattern ) option could be used to assign the same linepattern to all of the plot’s line patterns, letting line color indicate group values.Likewise, LINEATTRS= ( COLOR= color ) could be used to assign the same color toall lines, letting line pattern indicate group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping step-line attributes (color, marker symbol, and linepattern) to one of the GraphData1 - GranphDataN style elements.

Example Program and Statement Details 369

Page 380: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements inGraphData1 - GraphDataN, if the index value is greater than N, then a modulo operationremaps that index value to a number less than N to determine which style element touse.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

JOIN=booleanspecifies whether the steps are connected.

Default: TRUE

JUSTIFY= ( LEFT | CENTER | RIGHT )specifies the location of the data point relative to the step.

Default: LEFT

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The Y-variable label. If a label is not defined, the Y-variable name.

Interaction: If the GROUP= option is specified, this option is ignored.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the step line connecting the data points. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the ContrastColor and LineStyle attributes of the GraphData1 -GraphDataN style elements, and the GraphDataDefault:LineThickness stylereference.

MARKERATTRS=style-element | style-element (marker-options) | (marker-options)specifies the attributes of the data markers. See “General Syntax for Attribute Options”on page 563 for the syntax on using a style-element and “Marker Options” on page565 for available marker-options.

Default:

• For non-grouped data, GraphDataDefault style element.

• For grouped data, the MarkerSymbol and ContrastColor attributes of theGraphData1 - GraphDataN style elements, and the GraphDataDefault:MarkerSizestyle reference.

370 Chapter 38 • STEPPLOT Statement

Page 381: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: DISPLAY=ALL or DISPLAY=(MARKERS) must be set for this optionto have any effect.

Interaction: This option’s COLOR= suboption overrides the default behavior forgrouped data: all markers the same color and the marker symbol alone distinguishesthe markers.

Interaction: This option’s SYMBOL= suboption overrides the default behavior forgrouped data: it holds the marker constant across group values and marker color alonedistinguishes the markers.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use ofcolors, marker symbols, and line patterns between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot be used for determining axis types andlabels.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

ROLENAME=( rolename-list )specifies user-defined roles for information contained in data columns.

Default: no default

(rolename-list)a blank-separated list of rolename = column pairs.

For example, ROLENAME= ( TIP1=OBS ) assigns the column OBS to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X, Y, CURVELABEL, DATALABEL, ERRORLOWER,ERRORUPPER, GROUP, and INDEX.

Interaction: For this option to take effect, the TIP= option must also be used.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

TIP=(role-list)specifies the information to display when the cursor is positioned over the step line. Ifthis option is used, it replaces all the information displayed by default. Roles forcolumns that do not contribute to the step plot can be specified along with roles thatdo.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X, Y, DATALABEL, ERRORLOWER, ERRORUPPER, and GROUP.

Example Program and Statement Details 371

Page 382: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

(role-list)an ordered, blank-separated list of unique STEPPLOT and user-defined roles.STEPPLOT roles include X, Y, CURVELABEL, DATALABEL,ERRORLOWER, ERRORUPPER, and GROUP.

Note: CURVELABEL is considered a role only when it is assigned a column ofvalues. It is not considered a role and does not display tooltips when assigneda string.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles Xand Y as well as the column OBS, which is not assigned to any pre-defined StepPlotrole. The OBS column must first be assigned a role.

ROLENAME=(TIP1=OBS) TIP= (TIP1 X Y)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role or BEST6. if no formatis assigned to a numeric column.

(role-format-list)a list of rolename = format pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP= (TIP1 X ERRORUPPER ERRORLOWER) TIPFORMAT=(ERRORUPPER=5.3 ERRORLOWER=5.3)

Requirement: This option provides a way to control the formats of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

TIPLABEL=(role-format-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of rolename = "string" pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP= (TIP1 X ERRORUPPER ERRORLOWER) TIPLABEL=(ERRORUPPER="1 STD ERROR" ERRORLOWER="-1 STD ERROR")

Requirement: This option provides a way to control the labels of columns that appearin tooltips. Only the roles that appear in the TIP= option are used. Columns must beassigned to the roles for this option to have any effect. See the ROLENAME= option.

URL=character-columnspecifies an HTML page to display when a step line segment is selected.

372 Chapter 38 • STEPPLOT Statement

Page 383: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: no default

character-columneach value of the column must be a valid HTML page reference (HREF). Forexample, http://www.sas.com/technologies/analytics/index.html.

Requirement: To generate selectable bars, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay for the specified axis. For more information, see “How Axis Features areDetermined” on page 395.

Example Program and Statement Details 373

Page 384: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

374 Chapter 38 • STEPPLOT Statement

Page 385: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 39

SURFACEPLOTPARMStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379

Description and SyntaxCreates a three-dimensional surface representing a response variable evaluated over a gridof X and Y values.

SURFACEPLOTPARM X = numeric-column | expressionY = numeric-column | expressionZ = numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 376:

375

Page 386: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph surfaceplotparm; begingraph; entrytitle "Surface Plot of Lake Bed"; layout overlay3d / cube=false; surfaceplotparm x=length y=width z=depth / reversecolormodel=true surfacecolorgradient=depth colormodel=twocoloraltramp; endlayout; endgraph; end;run;/* create gridded data for surface */proc g3grid data=sashelp.lake out=gridded; grid width*length = depth / naxis1=75 naxis2=75;run;

proc sgrender data= gridded template=surfaceplotparm;run;

Statement SummaryThe SURFACEPLOTPARM statement assumes that the Z response values have beenprovided for a uniform X-Y grid. Missing Z values leave a “hole” in the surface. Theobservations in the input data set should form an evenly spaced grid of horizontal (X andY) values and one vertical (Z) value for each of these combinations. The observationsshould be in sorted order of Y and X to obtain an accurate graph.

376 Chapter 39 • SURFACEPLOTPARM Statement

Page 387: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

You can use the G3GRID procedure to interpolate the necessary values to produce a dataset with nonmissing Z values for every combination of X and Y. The G3GRID procedurecan also smooth data with spline interpolations. For further details, see the documentationfor PROC G3GRID in the SAS/GRAPH: Reference .

Using PROC G3GRID, the following code performs a Spline interpolation and generatesthis figure:

data nums; do i=1 to 30; X=10*ranuni(33)-5; Y=10*ranuni(35)-5; Z=sin(sqrt(x*x+y*y)); output; end;run; proc g3grid data=nums out=gridded; grid y*x=z / spline axis1=-5 to 5 by .1 axis2=-5 to 5 by .1;run;proc sort data=gridded; by y x; run;

proc template; define statgraph g3grid_surface; begingraph; entrytitle "Spline Interpolation"; layout overlay3d; surfaceplotparm x=x y=y z=z / surfacetype=fill; endlayout; endgraph; end;

Example Program and Statement Details 377

Page 388: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

run;

proc sgrender data=gridded template=g3grid_surface;run;

The KDE procedure can produce an output data set of gridded X-Y values where the Zvalue is computed to be a Kernel Density Estimate of the distribution of X and Y. Forfurther details, see the documentation for PROC KDE in MISSING Bookref .

Using PROC KDE on the nums data generated in the previous example, the following codecomputes a Kernel Density Estimate and generates this figure:

/* use the nums data generated in the previous example */proc kde data=nums; bivar x y / ngrid=100 out=binned(rename=(value1=X value2=Y));run;proc sort data=binned; by y x; label x="X" y="Y";run;

proc template; define statgraph kde_surface; begingraph; entrytitle "Kernel Density Estimate"; layout overlay3d; surfaceplotparm x=x y=y z=density / surfacetype=fill; endlayout; endgraph; end;run;

378 Chapter 39 • SURFACEPLOTPARM Statement

Page 389: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

proc sgrender data=binned template=kde_surface;run;

The SURFACEPLOTPARM does not support the tooltips that are enabled by theIMAGEMAP= option in the ODS GRAPHICS statement.

Required ArgumentsX=numeric-column | expression

specifies the X coordinates of the grid.

Y=numeric-column | expressionspecifies the Y coordinates of the grid.

Z=numeric-column | expressionspecifies the height of response values.

Note: The input data should be sorted by both 1) the Y column and 2) the X column.The sort direction for Y should be ascending. The sort direction of X be eitherascending or descending.

Options

Statement Option Description

COLORMODEL Specifies a style element that is used todetermine the colors of the contour lines orfilled areas.

DATATRANSPARENCY Specifies the degree of the transparency of thesurface.

FILLATTRS Specifies the appearance of the filled surface orthe wire-frame mesh.

LEGENDLABEL Specifies a label for use in a legend.

NAME Assigns a name to a plot statement for referencein other template statements.

PRIMARY Specifies that the data columns for this plot andthe plot type be used for determining defaultaxis features.

REVERSECOLORMODEL Specifies whether to reverse a gradient definedby the COLORMODEL= option.

SURFACECOLORGRADIENT Specifies a column that is used to map surfacecolors to a continuous gradient.

SURFACETYPE Specifies how the surface is displayed.

COLORMODEL=style-elementspecifies a style element that is used to determine gradient surface colors.

Default: The ThreeColorRamp style element.

Example Program and Statement Details 379

Page 390: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

style-elementName of a style element. The style element should contain these style attributes:

STARTCOLOR specifies a color for the smallest datavalue of theSURFACECOLORGRADIENTvariable

NEUTRALCOLOR specifies a color for the midpoint of therange Of theSURFACECOLORGRADIENTvariable

ENDCOLOR specifies a color for the highest data valueof the SURFACECOLORGRADIENTvariable

Interaction: For this option to have any effect, the SURFACECOLORGRADIENT=option must also be used.

The REVERSECOLORMODEL= option can be used to reverse the start and end colorsof the ramp assigned to the color model.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the surface.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

FILLATTRS=style-element | style-element (fill-options) | (fill-options)specifies the color of the filled surface or the wire-frame mesh. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “FillOptions” on page 564 for available fill-options.

Default: The GraphDataDefault:Color style reference.

Interaction: The SURFACECOLORGRADIENT= option is ignored if this option isspecified.

LEGENDLABEL= "string"specifies a label for use in a legend.

Default: The Z-variable label. If a label is not defined, the Z-variable name.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Details: This option is needed only when two or more plots within an OVERLAY3Dlayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

380 Chapter 39 • SURFACEPLOTPARM Statement

Page 391: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

REVERSECOLORMODEL=booleanspecifies whether to reverse a gradient (color ramp) defined by theCOLORMODEL= option.

Default: FALSE

SURFACECOLORGRADIENT=numeric-columnspecifies a column that is used to map surface colors to a continuous gradient.

Default: no default

Interaction: This option is ignored if the FILLATTRS== option is specified.

SURFACETYPE=FILLGRID | FILL | WIREFRAMEspecifies how the surface is displayed.

Default: FILLGRID

FILLGRIDa filled surface with superimposed grid lines

FILLa filled surface without grid lines

WIREFRAMEan unfilled surface with grid lines

Example Program and Statement Details 381

Page 392: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

382 Chapter 39 • SURFACEPLOTPARM Statement

Page 393: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 40

VECTORPLOT Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385

Description and SyntaxCreates a plot of vectors (directed line segments).

VECTORPLOT X = numeric-column | expressionY = numeric-column | expressionXORIGIN = numeric-constant | numeric-column | expressionYORIGIN = numeric-constant | numeric-column | expression </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 384:

383

Page 394: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programdata CarPref; input Make $12. Model $13. (S1-S25) (1.);datalines;Cadillac Deville 8007990491240508971093809Chevrolet Aveo 0051200423451043003515698Chevrolet Cavalier 4053305814161643544747795Chevrolet Malibu 6027400723121345545668658Dodge Intrepid 7006000434101107333458708Dodge Stratus 3005005635461302444675655Dodge Neon 4005003614021602754476555Ford Taurus 2024006715021443530648655Ford Mustang 5007197705021101850657555Ford Focus 0021000303030201500514078Honda Accord 5956897609699952998975078Honda Civic 4836709507488852567765075Lincoln LS 7008990592230409962091909Pontiac Firebird 0107895613201206958265907Volkswagen Jetta 4858696508877795377895000Volkswagen Beetle 4858509709695795487885000Volvo S40 9989998909999987989919000;run;* Compute Two Component Model;ods graphics;ods exclude all;ods output mdprefplot=plotdata;proc prinqual data=CarPref n=2 replace mdpref method=mgv; id model; transform monotone(S1-S25);

384 Chapter 40 • VECTORPLOT Statement

Page 395: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

run;ods select all;

proc template; define statgraph vectorplot; begingraph; entrytitle "Multidimensional Preference Analysis"; entrytitle "of Preference Ratings for Automobiles"; layout overlayequated / equatetype=fit cycleattrs=true; referenceline y=0 / datatransparency=.7; referenceline x=0 / datatransparency=.7; vectorplot y=vec2 x=vec1 xorigin=0 yorigin=0 / datalabel=label2var shaftprotected=false; scatterplot y=prin2 x=prin1 / datalabel=idlab1 primary=true markerattrs=(symbol=circlefilled); endlayout; endgraph; end;run;

proc sgrender data=plotdata template=vectorplot;run;

Statement SummaryBy default in a VECTORPLOT, each vector starts at 0, 0 in the data space. To specifyalternative coordinates for the starting point, use the XORIGIN= and YORIGIN=arguments.

Required ArgumentsX=numeric-column | expression

specifies the column for the X values of the vector endpoints.

Y=numeric-column | expressionspecifies the column for the Y values of the vector endpoints.

XORIGIN=numeric-constant | numeric-column | expressionSpecifies the X data coordinate of the vector origin.

YORIGIN=numeric-constant | numeric-column | expressionSpecifies the Y data coordinate of the vector origin.

Options

Statement Option Description

ARROWDIRECTION Specifies the direction of the arrowhead at theend of a vector.

ARROWHEADS Specifies whether arrowheads are displayed onthe vectors.

Example Program and Statement Details 385

Page 396: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

ARROWHEADSHAPE Specifies the shape of the arrowheads.

CLIP Specifies whether the origin is considered whendetermining the data ranges for the axes.

DATALABEL Specifies the labels at the ends of the vectors.

DATALABELATTRS Specifies the color and font attributes of the datalabels.

DATATRANSPARENCY Specifies the degree of the transparency of thevector line and arrow.

GROUP Creates a separate vector plot for each uniquegroup value of the specified column.

INDEX Specifies indices for mapping line attributes(color and pattern) to one of the GraphData1 -GranphDataN style elements.

LEGENDLABEL Specifies a label for use in a legend.

LINEATTRS Specifies the properties of the series line.

NAME Assigns a name to a plot statement for referencein other template statements.

PRIMARY Specifies that the data columns for this plot andthe plot type be used for determining defaultaxis features.

ROLENAME Specifies roles for information defined by datacolumns.

SCALE Specifies the scale factor of the vector length.

TIP Specifies the information to display when thecursor is positioned over a vector line.

TIPFORMAT Specifies display formats for informationdefined by roles.

TIPLABEL Specifies display labels for information definedby roles.

XAXIS Specifies whether data are mapped to theprimary X (bottom) axis or the secondary X2(top) axis.

YAXIS Specifies whether data are mapped to theprimary Y (left) axis or the secondary Y2 (right)axis.

386 Chapter 40 • VECTORPLOT Statement

Page 397: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ARROWDIRECTION=OUT | IN |BOTHspecifies the placement of the arrowhead(s) at the end of the vector.

Default: OUT

OUTspecifies a single arrowhead, pointing away from the origin, at the end of the vectoraway from the origin.

INspecifies a single arrowhead, pointing toward the origin, at the end of the vectornear the origin.

BOTHspecifies two arrowheads. One arrowhead points away from the origin, at the endof the vector opposite from the origin. The other arrowhead points toward the origin,at the end of the vector near the origin.

Interaction: If ARROWHEADS=FALSE, this option is ignored.

Use the ARROWHEADSHAPE= option to control arrowhead appearance.

ARROWHEADS=booleanspecifies whether arrowheads are displayed on the vectors.

Default: TRUE

Interaction: When this option is set to FALSE, the ARROWDIRECTION= andARROWHEADSHAPE= options are ignored and all vectors are displayed asundirected line segments.

ARROWHEADSHAPE=OPEN | CLOSED | FILLED | BARBEDspecifies the shape of the arrowheads.

Default: OPEN

Interaction: This option is ignored if ARROWHEADS=FALSE.

Use the ARROWDIRECTION= option to control arrow direction.

CLIP=booleanspecifies whether the origin is considered when determining the data ranges for theaxes.

Default: FALSE.

FALSEThe origin contributes to data range for each axis. Each axis might be extended toforce the display of the origin.

TRUEThe origin is ignored when establishing axis scales. Each axis scale is determinedby the other plots in the overlay. This might result in the origin not being displayedif its data range is not within the data ranges of tips of the vectors.

DATALABEL=column | expressionspecifies the labels at the ends of the vectors.

Default: no default

The label positions are automatically adjusted to prevent the labels from colliding withother labels and other arrows.

Example Program and Statement Details 387

Page 398: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DATALABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the data labels. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default:

• For non-grouped data, the GraphDataText style element.

• For grouped data, the GraphData1:ContrastColor - GraphDataN:ContrastColorstyle references.

Interaction: For this option to take effect, the DATALABEL= option must also bespecified.

DATATRANSPARENCY=numberspecifies the degree of the transparency of the vector line and arrow.

Default: 0

Range: 0 (opaque) to 1 (entirely transparent)

GROUP=column | expressioncreates a distinct set of vector lines and data label colors for each unique group valueof the specified column.

Default: Each distinct group value might be represented in the graph by a differentcombination of color and line pattern. Lines vary according to the ContrastColor andLineStyle attributes of the GraphData1 - GraphDataN style elements.

Interaction: The group values are mapped in the order of the data, unless theINDEX= option is used to alter the default sequence of line patterns and colors.

The LINEATTRS= option can be used to override the representations that are used toidentify the groups. For example, LINEATTRS=(PATTERN=SOLID) can be used toassign the same pattern to all of the lines, letting the line color distinguish group values.Likewise, LINEATTRS=(COLOR=BLACK) can be used to assign the same color toall of the lines, letting the line pattern distinguish group values.

INDEX=positive-integer-column | expressionspecifies indices for mapping line attributes (color and pattern) to one of theGraphData1 - GranphDataN style elements.

Default: no default

Interaction: For this option to take effect, the GROUP= option must also be specified.

Interaction: All of the indexes for a specific group value must be the same. Otherwise,the results are unpredictable.

Interaction: If this option is not used, then the group values are mapped in the orderof the data.

Interaction: The index values are 1-based indices. For the style elements GraphData1- GraphDataN, if the index value is greater than N, then a modulo operation remapsthat index value to a number less than N to determine which style element to use.

Discussion: Indexing can be used to collapse the number of groups that are representedin a graph. For more information, see “Remapping Groups for Grouped Data” on page121.

LEGENDLABEL= "string"Specifies a label for use in a legend.

Default: The string specified on the NAME= option.

388 Chapter 40 • VECTORPLOT Statement

Page 399: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: If the GROUP= option is specified, this option is ignored.

LINEATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the vector line and arrowhead. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default:

• For non-grouped data, the GraphDataDefault style element.

• For grouped data, the ContrastColor, LineStyle, and LineThickness attributes ofthe GraphData1 - GraphDataN style elements.

NAME="string"assigns a name to a plot statement for reference in other template statements.

Default: no default

Restriction: The string is case sensitive, cannot contain spaces, and must define aunique name within the template.

Interaction: The string is used as the default legend label if the LEGENDLABEL=option is not used.

The specified name is used primarily in legend statements to coordinate the use of colorsand line patterns between the graph and the legend.

PRIMARY=booleanspecifies that the data columns for this plot and the plot type be used for determiningdefault axis features.

Default: FALSE

Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICElayout block.

Details: This option is needed only when two or more plots within an overlay-typelayout contribute to a common axis. For more information, see “When Plots Share Dataand a Common Axis” on page 397

ROLENAME=( role-name-list )specifies user-defined roles for information contained in data columns.

Default: no default

(role-name-list)a blank-separated list of rolename = column pairs.

For example, ROLENAME= ( TIP1=OBS ) assigns the column OBS to the user-defined role TIP1.

Requirement: The role names that you choose must be unique and different from thepre-defined roles X, Y, DATALABEL, XORIGIN, YORIGIN, GROUP, and INDEX.

Interaction: For this option to take effect, the TIP= option must also be used.

This option provides a way to add to the data columns that appear in tooltips specifiedby the TIP= option.

SCALE=numberspecifies the scale factor of the vector length.

Default: 1.0

Restriction: The number specified must be greater than 0.

Example Program and Statement Details 389

Page 400: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TIP=(role-list)specifies the information to display when the cursor is positioned over a vector line. Ifthis option is used, it replaces all the information displayed by default. Roles forcolumns that do not contribute to the vector plot can be specified along with roles thatdo.

Default: The columns assigned to these roles are automatically included in the tooltipinformation: X, Y, DATALABEL, XORIGIN, YORIGIN, and GROUP.

(role-list)an ordered, blank-separated list of unique VECTORPLOT and user-defined roles.VECTORPLOT roles include X, Y, DATALABEL, XORIGIN, YORIGIN,GROUP, and INDEX.

User-defined roles are defined with the ROLENAME= option.

The following example displays tooltips for the columns assigned to the roles X,Y, GROUP, and the column OBS, which is not assigned to any pre-definedVectorPlot role. The OBS column must first be assigned a role.

ROLENAME=(TIP1=OBS) TIP= (TIP1 X Y GROUP)

Requirement: To generate tooltips, you must include an ODS GRAPHICS ONstatement that has the IMAGEMAP option specified, and write the graphs to the ODSHTML destination.

Interaction: The labels and formats for the TIP variables can be controlled with theTIPLABEL= and TIPFORMAT= options.

TIPFORMAT=(role-format-list)specifies display formats for tip columns.

Default: The column format of the variable assigned to the role.

(role-format-list)a list of rolename = format pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X Y GROUP) TIPFORMAT=(TIP1=3.)

Requirement: Columns must be assigned to the roles for this option to have any effect.See the ROLENAME= option.

This option provides a way to control the formats of columns that appear in tooltips.Only the roles that appear in the TIP= option are used.

TIPLABEL=(role-format-list)specifies display labels for tip columns.

Default: The column label or column name of the variable assigned to the role.

(role-label-list)a list of rolename = "string" pairs separated by blanks.

ROLENAME=(TIP1=OBS) TIP=(TIP1 X Y GROUP) TIPLABEL=(TIP1="Observation #")

Requirement: Columns must be assigned to the roles for this option to have any effect.See the ROLENAME= option.

390 Chapter 40 • VECTORPLOT Statement

Page 401: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

This option provides a way to control the labels of columns that appear in tooltips. Onlythe roles that appear in the TIP= option are used.

XAXIS=X | X2specifies whether data are mapped to the primary X (bottom) axis or to the secondaryX2 (top) axis.

Default: X

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

YAXIS=Y | Y2specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2(right) axis.

Default: Y

Interaction: The overall plot specification and the layout type determine the axisdisplay. For more information, see “How Axis Features are Determined” on page395.

Example Program and Statement Details 391

Page 402: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

392 Chapter 40 • VECTORPLOT Statement

Page 403: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 5

Plot Axes

Chapter 41Axis Features in Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395

Chapter 42Axis Options for LAYOUT OVERLAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

Chapter 43Axis Options for LAYOUT OVERLAY3D . . . . . . . . . . . . . . . . . . . . . . . . . 425

Chapter 44Axis Options for LAYOUT LATTICE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437

Chapter 45Axis Options for LAYOUT OVERLAYEQUATED . . . . . . . . . . . . . . . . . . 455

Chapter 46Axis Options for LAYOUT DATALATTICE/DATAPANEL . . . . . . . . . . 467

393

Page 404: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

394

Page 405: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 41

Axis Features in Layouts

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395

How Axis Features are Determined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395Plot Data Are Mapped to a Designated Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396When Plots Share Data and a Common Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397Plot Axis Types Must Agree on Common Axes . . . . . . . . . . . . . . . . . . . . . . . . . . 400

Controlling Axis Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400Setting the Axis Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401Adjusting the Axis View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402Adjusting Axis Thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402Adjusting Axis Offsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403

OverviewGTL graphs are specified within layout blocks that enable you to control the graph displayfeatures, including the display of the axes for the plots within the layout. For example, theLAYOUT OVERLAY statement has XAXISOPTS= and YAXISOPTS= options thatenable you to specify axis features for the plots within the layout.

The following sections explain how the axis features are determined in a layout. Thesections also discuss the issues you must consider when setting the axis type or adjustingthe appearance of the axis display.

How Axis Features are Determined

OverviewThe GTL uses various criteria to determine the displayed axis features for a graph.Generally, axis features are based on the layout type, the order of plot statements in thelayout and the options specified on those statements, the use of primary and secondary axeson the plots (when secondary axes are supported), the plot type, the column(s) of data thatcontribute to defining the axis range, and the data formats for the contributing data columns.

395

Page 406: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

While the default axis features depend on a combination of the factors above, it is usefulto understand how the axis features are determined in the templates that you build:

• how the data are mapped to the plot axes

• how the various layout types manage the axes.

Plot Data Are Mapped to a Designated AxisDepending on the layout type and the plots that you specify within the layout, you canmanage up to four axes for 2-D plots:

• a primary X (bottom) axis

• a primary Y (left) axis

• a secondary X axis (X2 or “top” axis)

• a secondary Y axis (Y2 or “right” axis)

By default, plot data are mapped to the primary axes. To enable you to override the default,plot statements that support a secondary X2 axis provide an XAXIS= option that can mapdata to the X or X2 axis. Plot statements that support a Y axis provide a YAXIS= optionthat can map data to the Y or Y2 axis.

To determine the axis features within a layout, the GTL must first determine what datamust be mapped to a particular axis. Thus, your use of primary and secondary axes on plotspecifications affects the GTL’s determination of default axis features for the layout.

For example, the plot statements in the following template specify Y-data mappings to theY2 and Y axes:

proc template; define statgraph y2axis; begingraph; layout overlay; histogram weight / scale=count yaxis=y2; histogram weight / scale=percent yaxis=y; densityplot weight / normal(); endlayout; endgraph; end;run;proc sgrender data=sashelp.class template=y2axis;run;

396 Chapter 41 • Axis Features in Layouts

Page 407: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

In this example, the first HISTOGRAM maps its Y-axis data to the Y2 axis, and the secondHISTOGRAM maps its Y-axis data to the Y axis. The DENSITY plot does not explicitlymap its Y-axis data, so the default Y axis is used. None of the plots explicitly map X-data,so the default X axis is used for all three plots. Thus, the GTL must manage any interactionsthat result from representing multiple plots on the X and Y axes. For example, on the Xaxis, it must determine an appropriate data range for representing the data values of allthree plots.

When establishing axis features for each axis, the GTL determines which plot specificationsmap data to the axis. The GTL also collects the data for all of the plots that must berepresented and maps that data to the designated axis. The next section discusses the criteriathe GTL uses to determine the axis features for the axes after this mapping has been donefor each axis.

Note: When layout statements are nested, the complete nesting structure must be takeninto account. For example, if multiple plot statements are specified within an overlay-type layout that is in turn nested in a lattice-type layout, each layout's axis restrictionsapply to the graph.

When Plots Share Data and a Common Axis

OverviewIf a layout block contains multiple plots that share data and a common axis, the plot settingsoften interact in ways that affect the axis features. Axis features include the axis type, axislabel, tick-mark layout, and so on. The GTL resolves these interactions in ways that varyaccording to the layout block and plot statements.

Note: Axis interactions might not occur if other settings in the template prevent them. Asdiscussed in in “Plot Data Are Mapped to a Designated Axis” on page 396, if two plotstatements are within an OVERLAY layout, one of them might map its data to the Xaxis and the other might map its data to the X2 (top) axis, thus avoiding the interactionsthat might occur if they both mapped their data to the X axis.

How Axis Features are Determined 397

Page 408: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Axis Features in Overlay-type LayoutsOverlay-type layouts (OVERLAY, OVERLAYEQUATED, and PROTOTYPE, forexample) build a composite from one or more GTL-statements.

Within overlay-type layouts, if you do not explicitly set axis features in your templatestatements, the GTL automatically determines them. It sets the axis features based on thelayout(s) and plot(s) in the layout block and the data that are associated with the templateat run time.

If only one plot statement within an overlay-type layout generates an axis, then determiningaxis features is straight forward: the features are derived directly from the plot type and thecolumns that are used for the plot data. For example, if a LAYOUT OVERLAY blockcontains a single SCATTERPLOT and the X variable specifies a numeric column ofchildren’s weights, the default X-axis type is LINEAR. The default X-axis label is thecolumn label of the WEIGHT variable. If the WEIGHT variable has no defined label, thecolumn name is used as a label.

When an overlay-type layout contains multiple plots that generate axes, the GTL candetermine default axis features for the shared axes. Alternatively, you can use thePRIMARY= option on one of the plot statements to specify which plot you want the GTLto use. The following code fragment explicitly specifies that the SCATTERPLOT ofchildren’s weights be used to determine axis features within the layout:

layout overlay; scatterplot x=weight ... / primary=true; ...

• If no plot in an overlay-type layout is designated as primary, the data columns associatedwith the first plot that generates an axis are considered primary on a per-axis basis.

• If PRIMARY=TRUE for a plot within an overlay-type layout, that plot’s data columnsand data type determine the default axis features. An explicitly specified primary plotdetermines the default axis features regardless of where that plot statement occurswithin the layout block.

• Only one plot can be primary on a per-axis basis. If multiple plots specifyPRIMARY=TRUE for the same axis, the last one encountered is considered primary.

The following SCATTERPLOT specifies a string variable on the X= argument:

layout overlay; scatterplot x=name ... / primary=true; ...

In this case, the default X-axis type is DISCRETE and the X-axis label is the column labelof NAME, or the column name if no label exists.

If a SCATTERPLOT’s X= argument specifies a column that has a SAS DATETIMEformat, the default X-axis type is TIME and the default X-axis label is the column label orname of the datetime column:

layout overlay; scatterplot x=date ... / primary=true; ...

For some plot types, the default axis type does not directly correlate to the specifiedcolumn’s data type. For example, the following code fragment specifies a BARCHARTfor the numeric column AGE:

layout overlay; barchart x=age ... / primary=true; ...

398 Chapter 41 • Axis Features in Layouts

Page 409: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Because a BARCHART requires a discrete X axis, the default X-axis type in this case isDISCRETE, in spite of the fact that column AGE is numeric. The X-axis label is the columnlabel of AGE, or the column name if no label exists.

Finally, consider a HISTOGRAM that is set as the primary plot in the layout and that binsdata values:

layout overlay; histogram weight / binaxis=true primary=true; ...

In this case, the default X-axis type is LINEAR, but the histogram’s data bins are used bydefault as the basis for the axis tick marks.

Axis Features in Data Panel and Data Lattice LayoutsThe criteria discussed in“Axis Features in Overlay-type Layouts” on page 398 apply todetermining the default axis features for the plots within DATAPANEL andDATALATTICE layouts. Both of these layout types nest a LAYOUT PROTOTYPEstatement within their layout blocks. In both cases, the plot statements within the LAYOUTPROTOTYPE block—an overlay-type layout—determine the axis features for the plotdisplay.

However, one distinction is worth noting. The DATAPANEL and DATALATTICElayouts do not support the display of secondary X2 (top) or secondary Y2 (right) axes.Thus, you cannot use secondary axes within these layout types to avoid competition amonglayout cells for determining axis features in the plot display.

Axis Features in Lattice-type LayoutsThe LAYOUT LATTICE statement can create a grid of graphs that automatically alignsplot areas, data display areas, labels, and headers across the columns and rows in the layout.The layout gives you the option of unifying the scale of the data ranges that are displayedin the graphs.

If a LAYOUT LATTICE specification generates only one cell, then no competition existsbetween cells for determining axis features in the display. In this case, the axis features arederived directly from the plot type and the columns used for the plot data.

Similarly, for multi-cell displays, if either or both of the optionsCOLUMNDATARANGE= or ROWDATARANGE= uses the DATA setting to scale axisdata ranges separately for each cell in the layout, then the layout cells are independent. Theindependent cells do not interact with each other for determining the axis features in thedisplay.

Axes are shared in the layout when either or both of the options COLUMNDATARANGE=or ROWDATARANGE= is used to unite axis data ranges for layout cells. By default inthose cases, the first cell that is drawn (by default, the top left cell) determines the axisfeatures in the display. The same features are used in all of the grid’s layout cells. If youspecify external axes for the columns or rows in the layout, you can specify desired axisfeatures on the appropriate COLUMNAXIS or ROWAXIS statements used in the layout.In that case, any XAXIS= or YAXIS= options on individual plot statements are ignored.

For an example LATTICE layout with external axes, see the Example Program inChapter7, “LAYOUT LATTICE Statement,” on page 73.

Note: LATTICE layouts support stand-alone plots, which are single plot statements thatare specified directly in the LATTICE layout block and are not nested within an overlay-type layout. Stand-alone plots within a LATTICE layout cannot support a secondaryaxis, so the layout in those cases ignores any XAXIS= or YAXIS= options on the plotstatement.

How Axis Features are Determined 399

Page 410: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Axis Features in Gridded LayoutsIn a GRIDDED layout the layout cells are independent of one another. Plot statementswithin the layout cells do not share data and are not represented on a common axis. Thus,no competition exists among layout cells for determining the axis features.

Note: GRIDDED layouts support “stand-alone plots,” which are single plot statementsthat are specified directly in the GRIDDED layout block and are not nested within anoverlay-type layout. Stand-alone plots within a GRIDDED layout cannot support asecondary axis, so the layout in those cases ignores any XAXIS= or YAXIS= optionson the plot statement.

Plot Axis Types Must Agree on Common AxesThe GTL is extremely flexible and enables you to generate a wide variety of plot displays.However, if you request incompatible plot displays within the same layout, the results areunpredictable.

“When Plots Share Data and a Common Axis” on page 397 discusses the criteria GTL usesto determine the default axis features. After the axis type has been determined, the GTLexpects that all plots that share that axis will have the assigned axis type. The expectationapplies whether you specify axis features in your template or let GTL determine defaultfeatures.

For example, a BOXPLOT cannot be overlaid by a LINEPARM: the two types of plotdisplay are incompatible within the same set of axes. Thus, if you were to use both aBOXPLOT statement and a LINEPARM statement within a LAYOUT OVERLAY block,only one of them can be displayed. The GTL therefore displays the primary plot (the firstspecified plot by default, or the plot designated as primary by setting PRIMARY=TRUE).The other plot is not displayed.

Similarly, a BARCHART requires a discrete X-axis, whereas a HISTOGRAM cannot bedisplayed on a discrete axis. If you specify both a BARCHART and a HISTOGRAM withinthe same overlay-type layout, only the primary plot is displayed and the other plot is rejectedfrom the display.

Axis types must also be the same for plots that must share an axis across the columns orrows in a multi-cell layout. For example, in a LAYOUT LATTICE, the GTL expects thatplots have the same axis type and data ranges if they are to share an external axis. Otherwise,the external axis cannot be displayed for that row or column.

Controlling Axis Features

OverviewTo enable you to control axis features within each of the layout types, there are differentsets of axis options for the different types of axes:

Option Category Used With ...

2-D Axis Options LAYOUT OVERLAY statement

3-D Axis Options LAYOUT OVERLAY3D statement

400 Chapter 41 • Axis Features in Layouts

Page 411: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Option Category Used With ...

Equated Axis Options LAYOUT OVERLAYEQUATED statement

Lattice Axis Options LAYOUT LATTICE statement

DataLattice/DataPanel Axes LAYOUT DATALATTICE and LAYOUTDATAPANEL statements

The options that are available for each layout are documented separately, but it is worthdiscussing the following tasks in general for all of the layout types:

• Setting the Axis Type

• Adjusting the Axis View

• Adjusting Axis Thresholds

• Adjusting Axis Offsets

Setting the Axis TypeWithin any given layout in the graph display, each plot axis is always of a particular type.In the default cases, the axis type is always LINEAR, DISCRETE, or TIME.

The axis options for each layout statement include a TYPE= option that enables you tospecify an axis type that overrides the default selection mechanisms. When you overridethe default axis type, you must be sure to specify the correct axis type for the plot(s) thatyou are defining. For every plot in the template language, the documentation indicates whataxis types it supports.

Each axis type has features specific to that type, and the following axis options enable youto specify features for the different types:

LINEAROPTS = ( linear-suboptions )DISCRETEOPTS = ( discrete-suboptions )TIMEOPTS= ( time-suboptions )LOGOPTS = ( log-suboptions )

One or more of these options can be specified for an axis, but the specified settings areapplied only to the axis type that supports them.

For example, a BarChart has two axes – a TYPE=DISCRETE axis for the X axis and aTYPE=LINEAR axis for the Y axis. If a numeric column (for example, Age) is assignedto the X role, this column’s values are always treated as discrete values, never as acontinuous range of values. You cannot request another axis type for the X axis, but youcan request a different axis type for the Y axis.

Sometimes you want a specialized axis type depending on the nature of the data. Forexample, if the data have a very large range of values (orders of magnitude apart), youcould request that the values be displayed on a logarithmic scale. To set a logarithmic scale,use the TYPE=LOG axis option.

Time series data benefit from displaying the X axis with a TYPE=TIME axis. A TIME axistype requires that the column values are SAS Date, Time, or Datetime values.

3-D plots such as BIHISTOGRAM3DPARM and SURFACEPLOTPARM always useTYPE=LINEAR for X, Y, and Z axes.

Controlling Axis Features 401

Page 412: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Note: Certain plot types or layouts might impose restrictions on what type of axis can beassigned. The documentation for each plot and layout type identifies any restrictionsthat might apply to the axes.

Adjusting the Axis ViewThe VIEWMIN= and VIEWMAX= axis options can be used to adjust the view of an axis.You can specify minimum data values to include in the display, maximum data values, orboth (the specified values might be adjusted by the threshold calculation). By default, theVIEWMIN= value is the minimum data value for the specified axis and the VIEWMAX=value is the maximum data value for the specified axis.

A VIEWMIN= value that is greater than the data minimum or a VIEWMAX= value thatis less than the data maximum acts like a “zoom in” operation. The adjusted view reducesthe range of values represented on the axis and can sometimes exclude markers, lines, orfills that would normally appear.

A VIEWMIN= value that is less than the data minimum or a VIEWMAX= value that isgreater than the data maximum acts like a “zoom out” operation. The adjusted view extendsthe range of values represented on the axis and sometimes compresses the markers, lines,or fills into a smaller area.

The following figure shows how the view settings can affect the tick and data displays.

Adjusting Axis ThresholdsThe THRESHOLDMIN = and THRESHOLDMAX = axis options can be used to set a biasfor including one more tick mark outside of either end of the data range (or VIEWMIN/VIEWMAX range) on a continuous, linear axis. The threshold range is from 0 (do notinclude the tick mark) to 1 (include the tick mark). The default is 0.30. The bias at the

402 Chapter 41 • Axis Features in Layouts

Page 413: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

minimum end of the axis is calculated using the THRESHOLDMIN= value and theminimum data value (by default) or the VIEWMIN= value (if set).

The bias at the maximum end of the axis is calculated using the THRESHOLDMAX= valueand the maximum data value (by default) or the VIEWMAX= value (if set).

Specifying THRESHOLDMIN=0 and THRESHOLDMAX=0 prevents the tick marksfrom extending beyond the data range. Specifying THRESHOLDMIN=1 andTHRESHOLDMAX=1 ensures that the data range is bounded by tick marks.

The following figure shows how the threshold settings can affect the tick display on anaxis. In the figure, 8 is the minimum value for the display and 29 is the maximum value.

Adjusting Axis OffsetsThe OFFSETMIN = and OFFSETMAX = axis options can be used to reserve an area atthe minimum end of an axis, the maximum end, or both ends. No tick marks are displayedin the reserved areas.

The offset range is from 0 to 1, and the specified value is used to calculate the offset as apercentage of the full axis length. The larger the offset area that is reserved, the less spaceis available for the tick display area. The default offset reserves just enough area to fullydisplay markers and other graphical features near the ends of an axis.

The following figure shows how offset values of 0.08 might compare with the defaultoffsets for a continuous axis.

Controlling Axis Features 403

Page 414: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

This next figure shows how offset values might affect the discrete axis of a bar chart.

404 Chapter 41 • Axis Features in Layouts

Page 415: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 42

Axis Options for LAYOUTOVERLAY

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405General Options for All Axes in an Overlay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406Options for Discrete X or X2 Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412Options for Linear Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412Options for Log Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417Options for Time Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419

Description and SyntaxAxis options for the plots within an OVERLAY layout are specified with the followingoptions on a LAYOUT OVERLAY statement:

XAXISOPTS= (axis-options)

YAXISOPTS= (axis-options)

X2AXISOPTS= (axis-options)

Y2AXISOPTS= (axis-options)

Example Program and Statement Details

OverviewThe LAYOUT OVERLAY statement provides the XAXISOPTS=, YAXISOPTS=,X2AXISOPTS=, Y2AXISOPTS= options that enable you to manage the axis displayseparately for the X, Y, X2, and Y2 axes. The following example template uses theYAXISOPTS= option to manage the grid lines, tick marks, and tick values on a Y axis:

begingraph; layout overlay / yaxisopts=( griddisplay=on display=(ticks tickvalues)

405

Page 416: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

); seriesplot x=month y=predict; endlayout;endgraph;

Within an OVERLAY layout block, each plot axis is always of a particular type. In thedefault cases, the axis type is always DISCRETE, LINEAR, or TIME. The TYPE= optionenables you to specify an axis type that overrides the default. For example, whenappropriate for the data, you can request a LOG axis. When you override the default axistype, you must be sure to specify the correct axis type for the plot(s) that you are defining.

Each axis type has features specific to that type, and the following axis options enable youto specify features for the different types: DISCRETEOPTS=, LINEAROPTS=,LOGOPTS= , and TIMEOPTS= . One or more of these options can be specified for anaxis, but the specified settings are applied only to the axis type that supports them.

Unless otherwise indicated in an option description, each axis option is available for theX, Y, X2, and Y2 axis.

Interaction. The OVERLAY’s axis options are ignored when the LAYOUT OVERLAYstatement is nested within another layout type that has external axes in effect. For example,the axis options are ignored when the OVERLAY is nested in a LAYOUT LATTICE witha COLUMNAXIS= or ROWAXIS= option in effect.

General Options for All Axes in an OverlayThe options that are documented in this section can be used with any of the axis types thatare supported within an OVERLAY layout. Subsequent sections in the chapter documentthe axis options that are available only for specific axis types: discrete, linear, log, or timeaxes.

Statement Option Description

DISCRETE Specifies options for a discrete X or X2 axis.This option is not available for a Y or Y2 axis.

DISPLAY Controls which axis features are displayed onthe primary axis.

DISPLAYSECONDARY Controls which axis features are displayed onthe secondary axis.

GRIDATTRS Specifies the attributes of the grid lines.

GRIDDISPLAY Specifies whether axis grid lines are displayed.

LABEL Specifies the axis label.

LABELATTRS Specifies the color and font attributes of the axislabel.

LINEAROPTS Specifies features for a standard numericinterval axis.

LOGOPTS Specifies features for a log axis.

406 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 417: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

OFFSETMAX Reserves an area at the maximum end of theaxis. No tick marks are displayed in the reservedarea.

OFFSETMIN Reserves an area at the minimum end of theaxis. No tick marks are displayed in the reservedarea.

REVERSE Specifies whether the tick values should appearin the reverse order.

SHORTLABEL Specifies an alternate axis label to use if thedefault or specified axis label is too long for theaxis length.

TICKSTYLE Specifies the placement of tick marks in relationto the axis line.

TICKVALUEATTRS Specifies the color and font attributes of the axistick values.

TIMEOPTS Specifies features for a TIME axis.

TYPE Specifies the type of axis to use.

DISCRETEOPTS=( discrete-axis-options )specifies one or more options for a discrete X or X2 axis. See “Options for Discrete Xor X2 Axes Only” on page 412.

DISPLAY=STANDARD | ALL | NONE | ( display-options )controls which axis features are displayed on the primary axis.

Default: STANDARD

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed

NONEspecifies that no axis features are displayed

(display-options)a list of space-delimited options enclosed in parentheses. The list must include oneor more of the following:

LABEL displays the axis labelLINE displays the axis lineTICKS displays the tick marksTICKVALUES displays the values that are represented by

the major tick marks

The default line attributes for the axis line and axis tick marks are defined in theGraphAxisLine style element.

See GRIDDISPLAY= and GRIDATTRS= for setting axis grid lines.

Example Program and Statement Details 407

Page 418: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DISPLAYSECONDARY=NONE | ALL | STANDARD | ( display-options )controls which axis features are displayed on the secondary axis. When data are mappedto the X or Y axis but not to the X2 or Y2, you can display X2 or Y2 (secondary) axisusing this option. The secondary axis is a duplicate of the X or Y axis (or X2 or Y2, ifdata are mapped only to X2 or Y2) but can have different display options.

Default: NONE

NONEspecifies that no axis features are displayed

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

(display-options)a list of space-delimited options enclosed in parentheses. The list must include oneor more of the following:

LABEL displays the axis labelLINE displays the axis lineTICKS displays the tick marksTICKVALUES displays the values that are represented by

the major tick marks

This option is ignored if data are mapped to both X and X2 axes or Y and Y2 axes.

GRIDATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the grid lines. See “General Syntax for Attribute Options” onpage 563 for the syntax on using a style-element and “Line Options” on page 564 foravailable line-options.

Default: The GraphGridLines style element.

Interaction: This option is ignored if the GRIDDISPLAY= option does not displaythe grid lines.

GRIDDISPLAY=AUTO_OFF | AUTO_ON | ON | OFFspecifies whether axis grid lines are displayed.

Default: AUTO_OFF

AUTO_OFFspecifies that grid lines are not displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="ON."

AUTO_ONspecifies that grid lines are displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="OFF."

ONspecifies that grid lines are always displayed. The current style has no override.

OFFspecifies that grid lines are never displayed. The current style has no override.

This option enables the template to absolutely control the display of grid lines or toallow interaction with the current style to decide whether grid lines are displayed.

408 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 419: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Supplied styles use DisplayOpts="AUTO," which means that the style has no“preference” about grid lines and the graphics template setting for grid lines is alwaysused.

Discussion: The following table shows the end results for various combinations of theGRIDDISPLAY= option and the DisplayOpts= attribute of the GraphGridLines styleelement. Most supplied templates use the default setting AUTO_OFF to indicate apreference for not displaying grid lines, but allowing the style to override.

GRIDDISPLAY= option DisplayOpts= style attribute Grid Lines Shown?

AUTO_OFF AUTO no

AUTO_OFF ON yes

AUTO_OFF OFF no

AUTO_ON AUTO yes

AUTO_ON ON yes

AUTO_ON OFF no

ON any value yes

OFF any value no

LABEL="string" | ( "string" …"string" )specifies the axis label. The string can be either a string literal or a dynamic. The listform implies that all included string literals or dynamics will be concatenated.

Default: The default label is derived from the primary plot in the layout. For moreinformation, see “When Plots Share Data and a Common Axis” on page 397.

Interaction: If the axis label is too long to fit along the axis, it is truncated by default.Use the SHORTLABEL= option to specify an alternate axis label to be used whenevertruncation would normally occur.

Interaction: This option is ignored if the DISPLAY= option does not display the axislabel.

LABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis label. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options” onpage 566 for available text-options.

Default: The GraphLabelText style element.

Interaction: This option is ignored if the DISPLAY= option does not display the axislabel.

LINEAROPTS=( linear-axis-options )specifies one or more linear-axis-options for a numeric interval axis. See “Options forLinear Axes Only” on page 412.

LOGOPTS=( log-axis-options )specifies one or more log-axis-options for a log axis. See “Options for Log Axes Only”on page 417.

Example Program and Statement Details 409

Page 420: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OFFSETMAX=AUTO | AUTOCOMPRESS | numberreserves an area at the maximum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTO

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe maximum end of an axis.

AUTOCOMPRESSAutomatic offset applied that prevents axis labels and tick values from extendingbeyond the axis length.

numberThe offset is expressed as a decimal proportion of the full axis length.

OFFSETMIN=AUTO | AUTOCOMPRESS | numberreserves an area at the minimum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTO

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe maximum end of an axis.

AUTOCOMPRESSAutomatic offset applied that prevents axis labels and tick values from extendingbeyond the axis length.

numberThe offset is expressed as a decimal proportion of the full axis length.

REVERSE=booleanspecifies whether tick values should appear in the reverse order.

Default: FALSE

SHORTLABEL="string"specifies an alternate axis label. This label is used when the default axis label or labelspecified by the LABEL= option is too long for the axis length.

Default: no default

Interaction: This option is ignored if the DISPLAY= option does not display the axislabel.

If the specified label is itself too long for the axis, it is truncated in the display.

TICKSTYLE=OUTSIDE | INSIDE | ACROSSspecifies the placement of tick marks in relation to the axis line. The figure shows thetick display on an X axis.

Default: The GraphAxisLines:TickDisplay style reference.

410 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 421: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

OUTSIDEdisplays tick marks outside of the axis frame.

INSIDEdisplays tick marks inside of the axis frame.

ACROSSdisplays tick marks across the axis line.

Interaction: This option is ignored if the DISPLAY= option does not display tickmarks.

This option has no affect on the placement of the tick values, which are always outsidethe axis frame.

This option applies to both major ticks and minor ticks.

TICKVALUEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis tick values. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: This option is ignored if the DISPLAY= option does not display tickvalues.

TIMEOPTS=( time-axis-options )specifies one or more time-axis-options for a time axis. See “Options for Time AxesOnly” on page 419.

TYPE=AUTO | DISCRETE | LINEAR | TIME | LOGspecifies the type of axis to use.

Default: AUTO

AUTORequests that the axis type be automatically determined, based on the overlaycontents. For more information, see “When Plots Share Data and a Common Axis”on page 397.

DISCRETEUse a DISCRETE axis if possible. The data for discrete axes can be character ornumeric. For an X or X2 axis, you can add a DISCRETEOPTS=( ) option list tocustomize this axis type. DISCRETEOPTS= is not supported on a Y or Y2 axis.

LINEARUse a LINEAR axis if possible. You can add a LINEAROPTS=( ) option list tocustomize this axis type.

TIMEUse a TIME axis if possible. Data for this axis must be SAS time, SAS date, or SASdatetime values. You can add a TIMEOPTS= ( ) option list to customize this axistype.

LOGUse a LOG axis if possible. You can add a LOGOPTS= ( ) option list to customizethis axis type.

Interaction: If this option is set to anything other than AUTO, plots within the layoutare dropped from the display if their data types or data ranges do not match the axistype requirements. For more information, see “Plot Axis Types Must Agree onCommon Axes” on page 400.

Example Program and Statement Details 411

Page 422: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: After the axis type is determined (whether you set a specific type or AUTOis in effect), only options supported by that axis type can be used. For example, ifTYPE=TIME, only the general OVERLAY axis options and those available onTIMEOPTS= are supported.

Options for Discrete X or X2 Axes OnlyDISCRETEOPTS=( discrete-axis-options )

specifies one or more options for a discrete X or X2 axis. This option is not availablefor a Y or Y2 axis. Options must be enclosed in parentheses. Each option is specifiedas a name = value pair and each pair is space separated.

Interaction: This option is ignored if the axis type is not DISCRETE.

TICKVALUEFITPOLICY=ROTATE | other-policyspecifies a policy for avoiding tick value collision on an X or X2 axis.

Default: ROTATE

The collision-avoidance policy that is most effective depends on the number of tickvalues, their length, and the length of the axis. The policy can be one of thefollowing:

ROTATE Tick values are rotated 45 degrees.ROTATETHIN Attempt ROTATE policy and then THIN

policy.STAGGER Tick values alternate between two rows.STAGGERROTATE Attempt STAGGER policy and then

ROTATE policy.STAGGERTHIN Attempt STAGGER policy and then

THIN policy.STAGGERTRUNCATE Attempt STAGGER policy and then

TRUNCATE policy.TRUNCATE Tick values are shortened when they

exceed a certain number of characters.TRUNCATEROTATE Attempt TRUNCATE policy and then

ROTATE policy.TRUNCATESTAGGER Attempt TRUNCATE policy and then

STAGGER policy.TRUNCATETHIN Attempt TRUNCATE policy and then

THIN policy.THIN Some tick values are removed.

Options for Linear Axes OnlyLINEAROPTS=( linear-axis-options )

specifies one or more linear-axis-options for a numeric interval axis. Options must beenclosed in parentheses. Each option is specified as a name = value pair and each pairis space separated.

Interaction: This option is ignored if the axis type is not LINEAR.

412 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 423: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Linear-Axis-Option Description

INTEGER Specifies that evenly spaced integer values areused for tick marks.

ORIGIN Specifies that the axis perpendicular to thecurrent axis be drawn at the indicated datavalue.

THRESHOLDMAX Specifies a bias for including one more tickmark at the maximum end of the axis.

THRESHOLDMIN Specifies a bias for including one more tickmark at the minimum end of the axis.

TICKVALUEFITPOLICY Specifies a policy for avoiding tick valuecollision. Only the default policy (THIN) isavailable for a Y or Y2 axis.

TICKVALUEFORMAT Specifies how to format the values for majortick marks.

TICKVALUELIST Specifies the order of the tick values for a linearaxis as list.

TICKVALUEPRIORITY Specifies whether an axis tick specification canextend the axis data range.

TICKVALUESEQUENCE Specifies the tick values for a linear axis bystart, end, and increment.

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

INTEGER=booleanspecifies that evenly spaced integer values are used for tick marks.

Default: FALSE

Interaction: This option is overridden by the TICKVALUELIST= orTICKVALUESEQUENCE= option.

Interaction: This option overrides the MAXDECIMALS= andPREFERREDDECIMALS= suboptions of the TICKVALUEFORMAT= option

ORIGIN=numberspecifies that the axis perpendicular to the current axis be drawn at the indicated datavalue.

Default: no default

Interaction: If the specified value is outside the data range for the current axis, the datarange is extended to include the value.

The axis line, ticks, and tick values of the “perpendicular” axis move to the locationindicated by the origin. The axis label is not moved.

Example Program and Statement Details 413

Page 424: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

This option is often used to create Cartesian axes (axes centered at ORIGIN=0).

Discussion: For managing origin settings, the GTL treats the X and Y axes as a pair,and the X2 and Y2 axes as a separate pair. Thus, if you set the Y-axis origin to 200, theX axis is drawn from that origin point. If the graph also displays an X2 axis, it isunaffected and does not move. Similarly, if you set an origin for the Y2 axis, the X2axis moves to that origin point and the X axis is unaffected.

If you set an origin for the Y2 axis and there is no X2 axis, then the origin setting forY2 does not affect the graph display. That is, the X axis does not move to that originpoint.

If you set an origin for an axis and the axis has a tick value at that origin value, the tickvalue is not displayed. Suppressing the tick value at the origin prevents the value fromcolliding with the axis value on the "perpendicular" axis. However, it is possible thatthe tick values on the orthogonal axes will collide.

THRESHOLDMAX= numberspecifies a bias for including one more tick mark at the maximum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

THRESHOLDMIN= numberspecifies a bias for including one more tick mark at the minimum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

TICKVALUEFITPOLICY=THIN | other-policyspecifies a policy for avoiding tick value collision. Only the default setting (THIN) isavailable for a Y or Y2 axis.

Default: THIN

The collision-avoidance policy that is most effective depends on the number of tickvalues, their length, and the length of the axis. For an X or X2 axis, the policy can beone of the following:

THINEliminate alternate tick values.

ROTATETick values are rotated 45 degrees.

ROTATETHINAttempt ROTATE policy and then THIN policy.

STAGGERTick values alternate between two rows.

STAGGERROTATEAttempt STAGGER policy and then ROTATE policy.

STAGGERTHINAttempt STAGGER policy and then THIN policy.

414 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 425: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TICKVALUEFORMAT=( format-options ) | DATA | formatspecifies how to format the values for major tick marks.

Default: (MAXWIDTH=8, MAXDECIMALS=6, PREFERREDDECIMALS=2,EXTRACTSCALE=FALSE)

(format-options)specifies one or more major tick value formatting options. Together, these optionsprovide parameters for determining an optimal format ( w.d, Ew., BESTw.) fordisplaying major tick values.

MAXWIDTH = integer Specifies the maximum width fordisplayed tick values. Values might berounded or converted to E-notation to fitinto this width.

MAXDECIMALS = integer Specifies the maximum number ofdecimals for displayed tick values.Values might be rounded or converted toE-notation to fit into this width.MAXWIDTH > MAXDECIMALS

PREFERREDDECIMALS = integer Specifies the number of decimal placesdesired for most values. The actualnumber might vary based on otherconstraints.

EXTRACTSCALE = boolean Specifies whether to extract some factorof ten from all tick values in order toreduce the overall width of the tick valuesand improve legibility. The extractedfactor is concatenated to the existing axislabel. Example of revised axis label:Number Sold (x1000)

DATAuse the format that has been assigned to the variable contributing to the axis (orBEST6. if no format is assigned) to control the formatting of the major tick values.

formatspecifies a format to apply to the major tick values.

Restriction: The format-options are used only when no format has been assigned tothe variable(s) that contribute to the axis or when the assigned format(s) are w.d, Ew.or BESTw.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: If the axis label is not displayed, the EXTRACTSCALE=TRUE format-option is ignored.

TICKVALUELIST=( numeric-list )specifies the tick values for a linear axis as list.

Default: An internal algorithm determines the tick marks based on the actual axis datarange or the data range established by the VIEWMIN= and VIEWMAX= options. Bydefault when this option is used, the only tick values that appear are the tick values innumeric-list that fall within the explicit data range (set by VIEWMIN= andVIEWMAX=) or implicit data range (set by the actual data minimum and datamaximum).

Example Program and Statement Details 415

Page 426: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Requirement: The numeric-list must be enclosed in parentheses and each itemseparated by a blank.

Interaction: This option overrides the INTEGER= option.

Interaction: This option is ignored if the TICKVALUESEQUENCE= option isspecified, or if the DISPLAY= option does not display tick values.

Interaction: The VIEWMIN= and VIEWMAX= options alter the axis data range. Ifthe VIEWMIN= option is set to the minimum tick list value and the VIEWMAX=option is set to the maximum tick list value, all ticks in the tick list are displayed.

Interaction: If the TICKVALUEPRIORITY= is set to TRUE, 1) the VIEWMIN= andVIEWMAX= options are ignored if they are fully enclosed by the numeric-list 2) thetick numeric-list can extend the implicit data range of the axis, but never reduce it.

The values in the list are formatted according to the setting for theTICKVALUEFORMAT= option.

TICKVALUEPRIORITY=booleanspecifies whether an axis tick specification (TICKVALUELIST= orTICKVALUESEQUENCE=) can extend the axis data range.

Default: FALSE

FALSEthe only tick values that appear are the user-specified tick values that fall within theexplicit data range (set by VIEWMIN= and VIEWMAX= ) or implicit data range(set by the actual data minimum and data maximum).

TRUEthe axis data range can be extended (but not reduced) to include the minimum andmaximum specified by either the TICKVALUELIST= orTICKVALUESEQUENCE= option. If minimum and maximum of the user-specified values are within the data range, this option has no effect.

Interaction: When this option is set to TRUE, the VIEWMIN= and VIEWMAX=options are ignored if they are fully enclosed by value range set by theTICKVALUELIST= or TICKVALUESEQUENCE= option.

Interaction: This option is ignored if the DISPLAY= option does not display tickmarks.

TICKVALUESEQUENCE=( sequence-options )specifies the tick values for a linear axis by start, end, and increment.

Default: An internal algorithm determines the tick marks based on the actual axis datarange or the data range established by the VIEWMIN= and VIEWMAX= options. Bydefault when this option is used, the only tick values that appear are those that fallwithin the explicit data range (set by VIEWMIN= and VIEWMAX=) or implicit datarange (set by the actual data minimum and data maximum).

(sequence-options)Three settings that control major tick values. All three options must be provided.

START = number Specifies the value for the first tick mark.END = number Specifies the value for the last tick mark.INCREMENT = number Specifies the increment for intermediate

tick marks between the first and last tickmarks. The END value always controlsthe last tick mark. The interval betweenthe last tick mark and the previous tick

416 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 427: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

mark might not necessarily be theINCREMENT value.

Interaction: This option overrides the INTEGER= option.

Interaction: The VIEWMIN= and VIEWMAX= options alter the axis data range. Ifthe VIEWMIN= option is set to the START= option value and the VIEWMAX= optionis set to the END= option value, all ticks in the tick sequence are displayed.

Interaction: If the TICKVALUEPRIORITY= option is set to TRUE, the tick sequencemight extend the explicit data range of the axis, but never reduce it.

Interaction: This option is ignored if the DISPLAY= option does not display tickmarks.

The values in the sequence are formatted according to the setting for theTICKVALUEFORMAT= option.

See also: TICKVALUELIST= option as an alternative for customizing tick marks.

VIEWMAX= numberspecifies the maximum data value to include in the display (the value might be adjustedby the threshold calculation). For more information, see “Adjusting the Axis View” onpage 402.

Default: The maximum value in the data for the specified axis.

Interaction: This option does not determine the maximum axis tick value displayed.The THRESHOLDMAX= value is used to determine the maximum tick value.

Interaction: This option has no effect if the TICKVALUEPRIORITY= is set to TRUE.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display (the value might be adjustedby the threshold calculation). For more information, see “Adjusting the Axis View” onpage 402.

Default: The minimum value in the data for the specified axis.

Interaction: This option does not determine the minimum axis tick value displayed.The THRESHOLDMIN= value is used to determine the maximum tick value.

Interaction: This option has no effect if the TICKVALUEPRIORITY= is set to TRUE.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

Options for Log Axes OnlyLOGOPTS=( log-axis-options )

specifies one or more log-axis-options for a log axis. Options must be enclosed inparentheses. Each option is specified as a name = value pair and each pair is spaceseparated.

Interaction: This option is ignored if the axis type is not LOG.

Log-Axis-Option Description

BASE Specifies the base of the logarithmic scale forthe axis values.

Example Program and Statement Details 417

Page 428: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Log-Axis-Option Description

MINORTICKS Specifies whether minor ticks are displayed.

TICKINTERVALSTYLE Specifies how to scale and format the values formajor tick marks.

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

BASE=10 | 2 | Especifies the base of the logarithmic scale for the axis values.

Default: 10

MINORTICKS=booleanspecifies whether minor ticks are displayed:

Default: FALSE

Restriction: Minor ticks can be displayed only when BASE=10 andTICKINTERVALSTYLE= is LOGEXPAND or LOGEXPONENT.

If this option is set to TRUE, the number of minor ticks is automatically determined.

TICKINTERVALSTYLE=AUTO | LOGEXPAND | LOGEXPONENT | LINEARspecifies how to scale and format the values for major tick marks.

Default: AUTO

AUTOA LOGEXPAND, LOGEXPONENT, or LINEAR representation is chosenautomatically based on the range of the data. When the data range is small (withinan order of magnitude), a LINEAR representation is typically used. Data rangesthat encompass several orders of magnitude typically use the LOGEXPAND orLOGEXPONENT representation.

LOGEXPANDMajor ticks are placed at uniform intervals at integer powers of the base. The tickvalues are expanded as follows:

Base=10

Base=2

Base=E

LOGEXPONENTMajor ticks are placed at uniform intervals at integer powers of the base. The tickvalues are only the integer exponents for all bases.

418 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 429: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

LINEARMajor tick marks are placed at non-uniform intervals that cover the range of thedata.

Restriction: For LOGEXPONENT, formats on data columns contributing to the axisare ignored. For LOGEXPAND, formats on data columns contributing to the axis areignored, although any "named format" on the column is retained. For LINEAR, ticksvalues are automatically formatted when the column format is not assigned or one ofw.d, Ew. or BESTw. Other formats (SAS defined or user-defined) are used if specified.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: When BASE=10 and LOGEXPAND or LOGEXPONENT is used, anintermediate tick is added whenever the axis data range is less than or equal to 1.5powers of 10.

If you use TICKINTERVALSTYLE=LOGEXPONENT, you might want to includeinformation in the axis label about which base is used.

VIEWMAX= numberspecifies the maximum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The maximum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The minimum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

Options for Time Axes OnlyTIMEOPTS=( time-axis-options )

specifies one or more time-axis-options for a time axis.

Variables associated with a time axis must be in SAS time, SAS date, or SAS datetimeunits and have an associated SAS time, date, or datetime format.

Options must be enclosed in parentheses. Each option is specified as a name = valuepair and each pair is space separated.

Interaction: This option is ignored if the axis type is not TIME.

Time-Axis-Option Description

INTERVAL Specifies the time interval between major tickmarks.

MINORTICKS Specifies whether minor ticks are displayed.

Example Program and Statement Details 419

Page 430: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Time-Axis-Option Description

SPLITTICKVALUE Specifies whether to split the tick values on anX or X2 axis, if possible. This option is notavailable on a Y or Y2 axis.

TICKVALUEFITPOLICY Specifies a policy for avoiding tick valuecollision on an X or X2 axis. This option is notavailable on a Y or Y2 axis.

TICKVALUEFORMAT Specifies how to format the values for majortick marks.

TICKVALUELIST Specifies the order of the tick values for a timeaxis as list.

TICKVALUEPRIORITY Specifies whether an axis tick specification canextend the axis data range.

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

INTERVAL=intervalspecifies the time interval between major ticks. Valid interval keywords are AUTO,SECOND, MINUTE, HOUR, DAY, TENDAY, WEEK, SEMIMONTH, MONTH,QUARTER, SEMIYEAR, YEAR.

The data column(s) mapped to a time axis must be in the same duration units: TIME,DATE, or DATETIME. The selection of an interval must be consistent with theduration unit. For example, if the data are in time units, you can select only AUTO,SECOND, MINUTE, HOUR.

Default: AUTO. An appropriate interval is chosen based on the data and the columndate/datetime/time format.

Interaction: This option is ignored if the TICKVALUELIST= option is used.

INTERVAL Unit Tick intervalDefault tick valueformat

AUTO DATE, TIME, orDATETIME

automaticallychosen

automaticallychosen

SECOND TIME orDATETIME

second TIME8.

MINUTE TIME orDATETIME

minute TIME8.

HOUR TIME orDATETIME

hour TIME8.

420 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 431: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

INTERVAL Unit Tick intervalDefault tick valueformat

DAY DATE orDATETIME

day DATE9.

TENDAY DATE orDATETIME

10 days DATE9.

WEEK DATE orDATETIME

7 days DATE9.

SEMIMONTH DATE orDATETIME

1st and 16th of eachmonth

DATE9.

MONTH DATE orDATETIME

month MONYY7.

QUARTER DATE orDATETIME

3 months YYQC6.

SEMIYEAR DATE orDATETIME

6 months MONYY7.

YEAR DATE orDATETIME

year YEAR4.

MINORTICKS=booleanspecifies whether minor ticks are displayed.

Default: FALSE

Interaction: The number of minor ticks is dependent on the value of the INTERVAL=option.

Interaction: This option is ignored if the DISPLAY= option does not display tickmarks, or if the TICKVALUELIST= option is used.

SPLITTICKVALUE=booleanspecifies whether to split the tick values on an X or X2 axis, if possible. This option isnot available for a Y or Y2 axis. For example, with INTERVAL= MONTH, this is howtick values are split:

Default: TRUE

TRUEaxis tick values are split into two lines allowing more tick values to appear

FALSEtypically, fewer tick values fit, causing thinning, rotation, or staggering of thevalues. See the TICKVALUEFITPOLICY= option.

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUEFORMAT= option is used.

Example Program and Statement Details 421

Page 432: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TICKVALUEFITPOLICY=THIN | ROTATE | ROTATETHIN | STAGGER |STAGGERROTATE | STAGGERTHIN

specifies a policy for avoiding tick value collision on an X or X2 axis. This option isnot available for a Y or Y2 axis.

Default: THIN

The collision-avoidance policy that is most effective depends on the number of tickvalues, their length, and the length of the axis. For an X or X2 axis, the policy can beone of the following:

THIN Some tick values are removed.

ROTATE Tick values are rotated 45 degrees.

ROTATETHIN Attempt ROTATE policy and then THINpolicy.

STAGGER Tick values alternate between two rows.

STAGGERROTATE Attempt STAGGER policy and thenROTATE policy.

STAGGERTHIN Attempt STAGGER policy and then THINpolicy.

Interaction: When SPLITTICKVALUE= TRUE, this option is ignored and only theTHIN policy is used.

TICKVALUEFORMAT=format | DATAspecifies how to format the values for major tick marks.

Default: The default format used by the INTERVAL= option. The default does notapply if TICKVALUELIST= is specified.

formatA SAS date, time, or datetime format to control how the major tick values aredisplayed. This format must be in the same duration units as the data column(s)mapped to a time axis: TIME, DATE, or DATETIME and should be appropriatefor the value of the INTERVAL= option. For example, if INTERVAL=MONTHand there are two years of data displayed on the axis, choosingTICKVALUEFORMAT=YEAR. would result in several ticks having the sameyear value.

DATASpecifies that the SAS date, time, or datetime format associated with the datacolumn assigned to the axis be used to control how the major tick values aredisplayed.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: If this option is specified, the SPLITTICKVALUE= option is ignored.

TICKVALUELIST=( time-constant-list | date-constant-list | datetime-constant-list |numeric-list )

specifies the tick values for a time axis as list.

Default: An internal algorithm determines the tick values.

422 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 433: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Requirement: The list must be enclosed in parentheses and each item separated by ablank. The items in the list must be in the same duration units as the data mapped tothe axis: TIME, DATE, or DATETIME. The values can be expressed as SAS TIME,DATE, or DATETIME constants (for example, "13:23"T, "11MAY06"D, or"11MAY06:13:23"DT) or their numeric equivalents.

Restriction: If TICKVALUEPRIORITY= is set to FALSE, this option does not extendthe data range of the axis. If the values fall within the default data range or that specifiedby the VIEWMIN= or VIEWMAX= options, they are used.

The values in the list are formatted according to the format specified on theTICKVALUEFORMAT= option. If TICKVALUEFORMAT= is not used, the valuesare formatted according to the column format (the default TICKVALUEFORMATvalue is not applied to these values).

TICKVALUEPRIORITY=booleanspecifies whether an axis tick specification (TICKVALUELIST=) can extend the axisdata range.

Default: FALSE

FALSEthe only tick values that appear are the user-specified tick values that fall within theexplicit data range (set by VIEWMIN= and VIEWMAX= ) or implicit data range(set by the actual data minimum and data maximum).

TRUEthe axis data range might be extended (but not reduced) to include the minimumand maximum specified by the TICKVALUELIST= option. If minimum andmaximum of the user-specified values are within the data range, this option has noeffect.

Interaction: When this option is set to TRUE, the VIEWMIN= or VIEWMAX=options might have no effect.

Interaction: This option is ignored if the DISPLAY= option does not display tickmarks.

VIEWMAX= numberspecifies the maximum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The maximum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The minimum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

Example Program and Statement Details 423

Page 434: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

424 Chapter 42 • Axis Options for LAYOUT OVERLAY

Page 435: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 43

Axis Options for LAYOUTOVERLAY3D

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425General Options for All Axes in an Overlay3D . . . . . . . . . . . . . . . . . . . . . . . . . . . 426Options for Linear Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430Options for Time Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432

Description and SyntaxAxis options for the plots within an OVERLAY3D layout are specified with the followingoptions on a LAYOUT OVERLAY3D statement:

XAXISOPTS= (axis-options)

YAXISOPTS= (axis-options)

ZAXISOPTS= (axis-options)

Example Program and Statement Details

OverviewThe LAYOUT OVERLAY3D statement provides XAXISOPTS=, YAXISOPTS=, andZAXISOPTS= options that enable you to manage the axis display separately for the X, Y,and Z axes. The following example template uses the YAXISOPTS= option to manage thedisplay of grid lines, tick marks, and tick values on a Y axis:

begingraph; layout overlay3d / yaxisopts=( griddisplay=on display=(ticks tickvalues) ); bihistogram3dparm x=rater y=customer z=percent; endlayout;endgraph;

425

Page 436: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Within an OVERLAY3D layout block, each plot axis is always either a linear or a timeaxis. The default axis-type setting is AUTO, which specifies that the axis type beautomatically determined by the plot or the overlay contents. The TYPE= option enablesyou to explicitly specify either a LINEAR or a TIME axis type. When you override thedefault axis type, you must be sure to specify the correct axis type for the plot(s) that youare defining.

Each axis type has features specific to that type, and the axis options LINEAROPTS= andTIMEOPS= enable you to specify features for a linear or a time axis. You can combineone or more general axis options with the options for the specific axis type. However,specified settings are applied only to the axis type that supports them. For example, if youspecify general axis options with time axis options and the generated graph produces alinear axis type, the time axis options are ignored.

Unless otherwise indicated in an option description, each axis option is available for theX, Y, and Z axis.

General Options for All Axes in an Overlay3DThe options that are documented in this section can be used with either axis type that issupported within an OVERLAY3D layout. Subsequent sections in the chapter documentthe axis options that are available only for the specific axis type: linear or time.

Statement Option Description

DISPLAY Controls which axis features are displayed.

GRIDATTRS Specifies the attributes of the grid lines.

GRIDDISPLAY Specifies whether axis grid lines are displayed.

LABEL Specifies the axis label.

LABELATTRS Specifies the color and font attributes of the axislabel.

LINEAROPTS Specifies options for a standard numericinterval axis.

OFFSETMAX Reserves an area at the maximum end of theaxis. No tick marks are displayed in the reservedarea.

OFFSETMIN Reserves an area at the minimum end of theaxis. No tick marks are displayed in the reservedarea.

TICKVALUEATTRS Specifies the color and font attributes of the axistick values.

TIMEOPTS Specifies options for a TIME axis.

TYPE Specifies the type of axis to use.

426 Chapter 43 • Axis Options for LAYOUT OVERLAY3D

Page 437: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DISPLAY=STANDARD | ALL | NONE | ( display-options )controls which axis features are displayed.

Default: STANDARD

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed

NONEspecifies that no axis features are displayed

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL displays the axis labelLINE displays the axis lineTICKS displays the tick marksTICKVALUES displays the values that are represented by

the major tick marks

The default line attributes for the axis line and axis tick marks are defined in theGraphAxisLine style element.

See GRIDDISPLAY= and GRIDATTRS= for setting axis grid lines.

GRIDATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the grid lines. See “General Syntax for Attribute Options” onpage 563 for the syntax on using a style-element and “Line Options” on page 564 foravailable line-options.

Default: The GraphGridLines style element.

Interaction: This option is ignored if the GRIDDISPLAY= option does not displaythe grid lines.

GRIDDISPLAY=AUTO_OFF | AUTO_ON | ON | OFFspecifies whether axis grid lines are displayed.

Default: AUTO_OFF

AUTO_OFFspecifies that grid lines are not displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="ON."

AUTO_ONspecifies that grid lines are displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="OFF."

ONspecifies that grid lines are always displayed. The current style has no override.

OFFspecifies that grid lines are never displayed. The current style has no override.

This option enables the template to absolutely control the display of grid lines or toallow interaction with the current style to decide whether grid lines are displayed.

Supplied styles use DisplayOpts="AUTO," which means that the style has no"preference" about grid lines and the graphics template setting for grid lines is alwaysused.

Example Program and Statement Details 427

Page 438: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Discussion: The following table shows the end results for various combinations of theGRIDDISPLAY= option and the DisplayOpts= attribute of the GraphGridLines styleelement. Most supplied templates use the default setting AUTO_OFF to indicate apreference for not displaying grid lines, but allowing the style to override.

GRIDDISPLAY= option DisplayOpts= style attribute Grid Lines Shown?

AUTO_OFF AUTO no

AUTO_OFF ON yes

AUTO_OFF OFF no

AUTO_ON AUTO yes

AUTO_ON ON yes

AUTO_ON OFF no

ON any value yes

OFF any value no

LABEL="string" | ( "string" …"string" )specifies the axis label. The string can be either a string literal or a dynamic. The listform implies that all included string literals or dynamics will be concatenated.

Default: The default label is derived from the primary plot in the layout. For moreinformation, see “When Plots Share Data and a Common Axis” on page 397.

Interaction: If the axis label is too long to fit along the axis, it is truncated.

Interaction: This option is ignored if the DISPLAY= option does not display the axislabel.

LABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis label. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options” onpage 566 for available text-options.

Default: The GraphLabelText style element.

Interaction: This option is ignored if the DISPLAY= option does not display the axislabel.

LINEAROPTS=( linear-axis-options )specifies one or more linear-axis-options for a numeric interval axis. See “Options forLinear Axes Only” on page 430.

OFFSETMAX=AUTO | numberreserves an area at the maximum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTO

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

428 Chapter 43 • Axis Options for LAYOUT OVERLAY3D

Page 439: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

AUTOReserves just enough area to fully display markers and other graphical features nearthe maximum end of an axis.

numberThe offset is expressed as a decimal proportion of the full axis length. For acontinuous axis, the offset follows the highest data value or highest tick value,whichever is greater.

OFFSETMIN=AUTO | numberreserves an area at the minimum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTO

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe minimum end of an axis.

numberThe offset is expressed as a decimal proportion of the full axis length. For acontinuous axis, the offset precedes the lowest data value or lowest tick value,whichever is less.

TICKVALUEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis tick values. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: This option is ignored if the DISPLAY= option does not display tickvalues.

TIMEOPTS=( time-axis-options )specifies one or more time-axis-options for a time axis. See “Options for Time AxesOnly” on page 432.

TYPE=AUTO | LINEAR | TIMEspecifies the type of axis to use.

Default: AUTO

AUTORequests that the axis type be automatically determined by the plot or the overlaycontents.

LINEARUse a LINEAR axis if possible. You can add a LINEAROPTS= ( ) option list tocustomize this axis type.

TIMEUse a TIME axis if possible. Data for this axis must be SAS time, SAS date, or SASdatetime values. You can add a TIMEOPS= ( ) option list to customize this axistype.

Interaction: If this option is set to anything other than AUTO, plots within the layoutare dropped from the display if their data types or data ranges do not match the axistype requirements. For more information, see “Plot Axis Types Must Agree onCommon Axes” on page 400.

Example Program and Statement Details 429

Page 440: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: After the axis type is determined (whether you set a specific type or AUTOis in effect), only options supported by that axis type can be used. For example, ifTYPE=TIME, only the general OVERLAY3D axis options and those available onTIMEOPS= are supported.

Options for Linear Axes OnlyLINEAROPTS=( linear-axis-options )

specifies one or more options for a numeric interval axis. Options must be enclosed inparentheses. Each option is specified as a name = value pair and each pair is spaceseparated.

Interaction: This option is ignored if the axis type is not LINEAR.

Linear-Axis-Option Description

INTEGER Specifies that evenly spaced integer values areused for tick marks.

THRESHOLDMAX Specifies a bias for including one more tickmark at the maximum end of the axis.

THRESHOLDMIN Specifies a bias for including one more tickmark at the minimum end of the axis.

TICKVALUEFORMAT Specifies how to format the values for majortick marks.

TICKVALUELIST Specifies the order of the tick values for a linearaxis as list.

TICKVALUESEQUENCE Specifies the tick values for a linear axis bystart, end, and increment.

INTEGER=booleanspecifies that evenly spaced integer values are used for tick marks.

Default: FALSE

Interaction: This option is overridden by the TICKVALUELIST= orTICKVALUESEQUENCE= option.

Interaction: This option overrides the MAXDECIMALS= andPREFERREDDECIMALS= suboptions of the TICKVALUEFORMAT= option

THRESHOLDMAX= numberspecifies a bias for including one more tick mark at the maximum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

THRESHOLDMIN= numberspecifies a bias for including one more tick mark at the minimum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

430 Chapter 43 • Axis Options for LAYOUT OVERLAY3D

Page 441: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

TICKVALUEFORMAT=( format-options ) | DATA | formatspecifies how to format the values for major tick marks.

Default: ( MAXWIDTH=8, MAXDECIMALS=6, PREFERREDDECIMALS=2,EXTRACTSCALE=FALSE)

(format-options)specifies one or more major tick value formatting options. Together, these optionsprovide parameters for determining an optimal format ( w.d, Ew., BESTw.) fordisplaying major tick values.

MAXWIDTH = integer Specifies the maximum width fordisplayed tick values. Values might berounded or converted to E-notation to fitinto this width.

MAXDECIMALS = integer Specifies the maximum number ofdecimals for displayed tick values.Values might be rounded or converted toE-notation to fit into this width.MAXWIDTH > MAXDECIMALS

PREFERREDDECIMALS = integer Specifies the number of decimal placesdesired for most values. The actualnumber might vary based on otherconstraints.

EXTRACTSCALE = boolean Specifies whether to extract some factorof ten from all tick values in order toreduce the overall width of the tick valuesand improve legibility. The extractedfactor is concatenated to the existing axislabel. Example of revised axis label:Number Sold (x1000)

DATAuse the format that has been assigned to the variable(s) contributing to the axis (orBEST6. if no format is assigned) to control the formatting of the major tick values.

formatuse this format to control how the major tick values are formatted.

Restriction: The format-option are used only when no format has been assigned to thevariable(s) that contribute to the axis or when the assigned format(s) are w.d, Ew. orBESTw.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: If the axis label is not displayed, the EXTRACTSCALE=TRUE is format-option ignored.

TICKVALUELIST=( numeric-list )specifies the tick values for a linear axis as list.

Default: An internal algorithm determines the tick values.

Example Program and Statement Details 431

Page 442: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Requirement: The numeric-list must be enclosed in parentheses and each itemseparated by a blank.

Interaction: This option overrides the INTEGER= option.

Interaction: The values in the list are formatted according to the setting for theTICKVALUEFORMAT= option.

If ticks are specified outside of the axis range, then the axis range is extended to displaythe ticks.

See also: TICKVALUESEQUENCE= option as an alternative for customizing tickmarks.

TICKVALUESEQUENCE=( sequence-options )specifies the tick values for a linear axis by start, end, and increment.

Default: An internal algorithm determines the tick marks.

(sequence-options)Three options that control major tick values. All three options must be provided.

START = number Specifies the value for the first tick mark.END = number Specifies the value for the last tick mark.INCREMENT = number Specifies the increment for intermediate

tick marks between the first and last tickmarks. The END value always controlsthe last tick mark. The interval betweenthe last tick mark and the previous tickmark might not necessarily be theINCREMENT value.

Interaction: This option overrides the INTEGER= option.

Interaction: This option is ignored if the DISPLAY= option does not display tickmarks.

Interaction: The values in the sequence are formatted according to the setting for theTICKVALUEFORMAT= option.

If ticks are specified outside of the axis range, then the axis range is extended to displaythe ticks.

See also: TICKVALUELIST= option as an alternative for customizing tick marks.

Options for Time Axes OnlyTIMEOPTS=( time-axis-options )

specifies one or more options for a time axis.

Variables associated with a time axis must be in SAS time, SAS date, or SAS datetimeunits and have an associated SAS time, date, or datetime format.

Options must be enclosed in parentheses. Each option is specified as a name = valuepair and each pair is space separated.

Interaction: This option is ignored if the axis type is not TIME.

432 Chapter 43 • Axis Options for LAYOUT OVERLAY3D

Page 443: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Time-Axis-Option Description

INTERVAL Specifies the time interval between major tickmarks.

MINORTICKS Specifies whether minor ticks are displayed.

TICKVALUEFORMAT Specifies how to format the values for majortick marks.

TICKVALUELIST Specifies the order of the tick values for a timeaxis as list.

INTERVAL=intervalspecifies the time interval between major ticks. Valid interval keywords are AUTO,SECOND, MINUTE, HOUR, DAY, TENDAY, WEEK, SEMIMONTH, MONTH,QUARTER, SEMIYEAR, YEAR.

The data column(s) mapped to a time axis must be in the same duration units: TIME,DATE, or DATETIME. The selection of an interval must be consistent with theduration unit. For example, if the data are in time units, you can select only AUTO,SECOND, MINUTE, HOUR.

Default: AUTO. An appropriate interval is chosen based on the data and the columndate/datetime/time format.

Interaction: This option is ignored if the TICKVALUELIST= option is used.

INTERVAL Unit Tick intervalDefault tick valueformat

AUTO DATE, TIME, orDATETIME

automaticallychosen

automaticallychosen

SECOND TIME orDATETIME

second TIME8.

MINUTE TIME orDATETIME

minute TIME8.

HOUR TIME orDATETIME

hour TIME8.

DAY DATE orDATETIME

day DATE9.

TENDAY DATE orDATETIME

10 days DATE9.

WEEK DATE orDATETIME

7 days DATE9.

SEMIMONTH DATE orDATETIME

1st and 16th of eachmonth

DATE9.

Example Program and Statement Details 433

Page 444: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

INTERVAL Unit Tick intervalDefault tick valueformat

MONTH DATE orDATETIME

month MONYY7.

QUARTER DATE orDATETIME

3 months YYQC6.

SEMIYEAR DATE orDATETIME

6 months MONYY7.

YEAR DATE orDATETIME

year YEAR4.

MINORTICKS=Booleanspecifies whether minor ticks are displayed.

Default: FALSE

Interaction: The number of minor ticks is dependent on the value of the INTERVAL=option. For example, if INTERVAL=YEAR, there would be four minor ticks (1 perquarter).

Interaction: This option is ignored if the DISPLAY= option does not display tickmarks, or if the TICKVALUELIST= option is used.

TICKVALUEFORMAT= format | DATAspecifies how to format the values for major tick marks.

Default: The default format used by the INTERVAL= option. The default does notapply if TICKVALUELIST= is specified.

formatA SAS date, time, or datetime format to control how the major tick values aredisplayed. This format must be in the same duration units as the data column(s)mapped to a time axis: TIME, DATE, or DATETIME and should be appropriatefor the value of the INTERVAL= option. For example, if INTERVAL=MONTHand there are two years of data displayed on the axis, choosingTICKVALUEFORMAT=YEAR. would result in several ticks having the sameyear value.

DATASpecifies that the SAS date, time, or datetime format associated with the datacolumn assigned to the axis be used to control how the major tick values aredisplayed.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

TICKVALUELIST=( time-constant-list | date-constant-list | datetime-constant-list |numeric-list )

specifies the tick values for a time axis as list.

Default: An internal algorithm determines the tick values.

Requirement: The list must be enclosed in parentheses and each item separated by ablank. The items in the list must be in the same duration units as the data mapped tothe axis: TIME, DATE, or DATETIME. The values can be expressed as SAS TIME,DATE, or DATETIME constants (for example, "13:23"T, "11MAY06"D, or"11MAY06:13:23"DT) or their numeric equivalents.

434 Chapter 43 • Axis Options for LAYOUT OVERLAY3D

Page 445: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: This option does not extend the data range of the axis. If the values fallwithin the default data range, they are used.

Interaction: The values in the list are formatted according to the setting for theTICKVALUEFORMAT= option. If TICKVALUEFORMAT= is not used, the valuesare formatted according to the column format (the default TICKVALUEFORMATvalue is not applied to these values).

Example Program and Statement Details 435

Page 446: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

436 Chapter 43 • Axis Options for LAYOUT OVERLAY3D

Page 447: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 44

Axis Options for LAYOUTLATTICE

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437General Options for All Axes in a Lattice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438Options for Discrete Column Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443Options for Linear Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444Options for Log Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449Options for Time Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450

Description and SyntaxAxis options for the plots within a LATTICE layout are specified with the followingstatements within a LAYOUT LATTICE statement block:

COLUMNAXIS /external-axis-options

ROWAXIS /external-axis-options

Example Program and Statement Details

OverviewThe LAYOUT LATTICE statement creates a grid of graphs that automatically aligns plotareas, data display areas, axis labels, and headers across the columns and rows of the layout.The axis data ranges can be scaled, and the axes for individual cells in the layout can bemanaged by row and by column using COLUMNAXIS and ROWAXIS statements.COLUMNAXIS statements are used within a COLUMNAXES block to externalizecolumn axes for the layout. Similarly, ROWAXIS statements are used within a ROWAXESblock to externalize row axes for the layout. For the specifications to take effect,

• UNION or UNIONALL data scaling must be set for the affected columns and rows.The data scaling is set with COLUMNDATARANGE= and ROWDATARANGE=options.

• Within the COLUMNAXES block, the number of COLUMNAXIS statements mustmatch the number of columns. Within the ROWAXES block, the number of ROWAXISstatements must match the number of rows. If you do not specify enough of either

437

Page 448: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

statement, the last statement is used on remaining cells. If you specify too manystatements, the extra statements are ignored.

The following example shows COLUMNAXIS statements for a lattice with two columns:

layout lattice / columns=2 columndatarange=union; columnaxes; columnaxis / griddisplay=on displaysecondary=(ticks tickvalues); columnaxis / griddisplay=on displaysecondary=(ticks tickvalues); endcolumnaxes;

/* rest of lattice definition */

endlayout;

COLUMNAXIS and ROWAXIS statements are similar to the XAXISOPTS= andYAXISOPTS= options for LAYOUT OVERLAY, with the following differences:

• COLUMNAXIS and ROWAXIS specify a secondary axis by using theDISPLAYSECONDARY= option, which shows a secondary axis on the opposite sideof the lattice.

• When COLUMNAXIS and ROWAXIS are used, any axis options specified on plotswithin the affected columns or rows are ignored. All axis features for the external axesmust be specified on the COLUMNAXIS or ROWAXIS statement.

• When COLUMNAXIS and ROWAXIS are used, any LAYOUTOVERLAYEQUATED layouts specified for cells in the affected columns or rows areimplemented as LAYOUT OVERLAY layouts. Equated axes are not supported onexternal axes.

In the default cases for each plot in the layout, the axis type is always DISCRETE, LINEAR,or TIME. The TYPE= option enables you to specify an axis type that overrides the default.For example, when appropriate for the data, you can request a LOG axis. When you overridethe default axis type, you must be sure to specify the correct axis type for the plot(s) thatyou are defining.

Each axis type has features specific to that type, and the following axis options enable youto specify features for the different types: DISCRETEOPTS= , LINEAROPTS= ,LOGOPTS= , and TIMEOPTS= . One or more of these options can be specified for anaxis, but the specified settings are applied only to the axis type that supports them.

General Options for All Axes in a LatticeThe options that are documented in this section can be used with any of the axis types thatare supported within a LATTICE layout. Subsequent sections in the chapter document theaxis options that are available only for specific axis types: discrete, linear, log, or time axes.

Statement Option Description

DISCRETEOPTS Specifies features for a discrete column axis.This option is not available in the ROWAXISstatement.

DISPLAY Controls which axis features are displayed onthe primary axis.

DISPLAYSECONDARY Controls which axis features are displayed onthe secondary axis.

438 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 449: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

GRIDATTRS Specifies the attributes of the grid lines.

GRIDDISPLAY Specifies whether axis grid lines are displayed.

LABEL Specifies the axis label.

LABELATTRS Specifies the color and font attributes of the axislabel.

LINEAROPTS Specifies features for a standard numericinterval axis.

LOGOPTS Specifies features for a log axis.

OFFSETMAX Reserves an area at the maximum end of theaxis. No tick marks are displayed in the reservedarea.

OFFSETMIN Reserves an area at the minimum end of theaxis. No tick marks are displayed in the reservedarea.

SHORTLABEL Specifies an alternate axis label to use if thedefault or specified axis label is too long for theaxis length.

TICKVALUEATTRS Specifies the color and font attributes of the axistick values.

TIMEOPTS Specifies features for a TIME axis.

TYPE Specifies the type of axis to use.

DISCRETEOPTS=( discrete-axis-options )specifies one or more options for a discrete X or X2 axis. See “Options for DiscreteColumn Axes Only” on page 443.

DISPLAY=STANDARD | ALL | NONE | ( display-options )controls which axis features are displayed on the primary axis.

Default: STANDARD

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed

ALLspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed

NONEspecifies that no axis features are displayed

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL displays the axis label

Example Program and Statement Details 439

Page 450: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

LINE displays the axis lineTICKS displays the tick marksTICKVALUES displays the values that are represented by

the major tick marks

The default line attributes for the axis line and axis tick marks are defined in theGraphAxisLine style element.

See GRIDDISPLAY= and GRIDATTRS= for setting axis grid lines.

DISPLAYSECONDARY=NONE | ALL | STANDARD | ( display-options )controls which axis features are displayed on the secondary axis.

Default: NONE

NONEspecifies that no secondary axis features are displayed

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

ALLspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL displays the axis labelLINE displays the axis lineTICKS displays the tick marksTICKVALUES displays the values that are represented by

the major tick marks

The secondary axis is a duplicate of the primary axis (the axis to which the data aremapped). It is on the opposite side of the lattice from the primary axis.

GRIDATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the grid lines. See “General Syntax for Attribute Options” onpage 563 for the syntax on using a style-element and “Line Options” on page 564 foravailable line-options.

Default: The GraphGridLines style element.

Interaction: This option is ignored if the GRIDDISPLAY= option does not displaythe grid lines.

GRIDDISPLAY=AUTO_OFF | AUTO_ON | ON | OFFspecifies whether axis grid lines are displayed.

Default: AUTO_OFF

AUTO_OFFspecifies that grid lines are not displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="ON".

AUTO_ONspecifies that grid lines are displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="OFF".

440 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 451: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ONspecifies that grid lines are always displayed. The current style has no override.

OFFspecifies that grid lines are never displayed. The current style has no override.

This option enables the template to absolutely control the display of grid lines or toallow interaction with the current style to decide whether grid lines are displayed. Whendisplayed, the grids appear in all cells.

Supplied styles use DisplayOpts="AUTO," which means that the style has no"preference" about grid lines and the graphics template setting for grid lines is alwaysused.

Discussion: The following table shows the end results for various combinations of theGRIDDISPLAY= option and the DisplayOpts= attribute of the GraphGridLines styleelement. Most supplied templates use the default setting AUTO_OFF to indicate apreference for not displaying grid lines, but allowing the style to override.

GRIDDISPLAY= option DisplayOpts= style attribute Grid Lines Shown?

AUTO_OFF AUTO no

AUTO_OFF ON yes

AUTO_OFF OFF no

AUTO_ON AUTO yes

AUTO_ON ON yes

AUTO_ON OFF no

ON any value yes

OFF any value no

LABEL="string" | ( "string" …"string" )specifies the axis label. The string can be either a string literal or a dynamic. The listform implies that all included string literals or dynamics will be concatenated

Default: The default label is derived from the primary plot in the layout. For moreinformation, see “When Plots Share Data and a Common Axis” on page 397.

Interaction: If the axis label is too long to fit along the axis, it is truncated by default.Use the SHORTLABEL= option to specify an alternate axis label to be used whenevertruncation would normally occur.

Interaction: This option is ignored if the DISPLAY= or DISPLAYSECONDARY=option does not display the axis label.

LABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis label. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options” onpage 566 for available text-options.

Default: The GraphLabelText style element.

Example Program and Statement Details 441

Page 452: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option is ignored if the DISPLAY= or DISPLAYSECONDARY=option does not display the axis label.

LINEAROPTS=( linear-axis-options )specifies one or more linear-axis-options for a numeric interval axis. See “Options forLinear Axes Only” on page 444.

LOGOPTS=( log-axis-options )specifies one or more log-axis-options for a log axis. See “Options for Log Axes Only”on page 449.

OFFSETMAX=AUTO | AUTOCOMPRESS | numberReserves an area at the maximum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTO

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe maximum end of an axis.

AUTOCOMPRESSAutomatic offset applied that prevents axis labels and tick values from extendingbeyond the axis length.

numberThe offset is expressed as a decimal proportion of the full axis length.

OFFSETMIN=AUTO | AUTOCOMPRESS | numberReserves an area at the minimum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTO

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe maximum end of an axis.

AUTOCOMPRESSAutomatic offset applied that prevents axis labels and tick values from extendingbeyond the axis length.

numberThe offset is expressed as a decimal proportion of the full axis length.

SHORTLABEL="string"specifies an alternate axis label. This label is used when the default axis label or labelspecified by the LABEL= option is too long for the axis length.

Default: no default

Interaction: This option is ignored if the DISPLAY= or DISPLAYSECONDARY=option does not display the axis label.

If the specified label is itself too long for the axis, it is truncated in the display.

442 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 453: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TICKVALUEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis tick values. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: This option is ignored if the DISPLAY= or DISPLAYSECONDARY=option does not display the axis label.

TIMEOPTS=( time-axis-options )specifies one or more time-axis-options for a time axis. See “Options for Time AxesOnly” on page 450.

TYPE=AUTO | DISCRETE | LINEAR | TIME | LOGspecifies the type of axis to use.

Default: AUTO

AUTORequests that the axis type be automatically determined, based on the overlaycontents. For more information, see “When Plots Share Data and a Common Axis”on page 397.

DISCRETEUse a DISCRETE X or X2 axis if possible. This setting is not available on aROWAXIS statement. The data for discrete axes can be character or numeric. Fora column axis, you can add a DISCRETEOPTS= ( ) option list to customize thisaxis type.

LINEARUse a LINEAR axis if possible. You can add a LINEAROPTS= ( ) option list tocustomize this axis type.

TIMEUse a TIME axis if possible. Data for this axis must be SAS time, SAS date, or SASdatetime values. You can add a TIMEOPTS= ( ) option list to customize this axistype.

LOGUse a LOG axis if possible. You can add a LOGOPTS= ( ) option list to customizethis axis type.

Options for Discrete Column Axes OnlyDISCRETEOPTS=( discrete-axis-options )

specifies one or more options for a discrete X or X2 axis. This option is not availablein the ROWAXIS statement. Options must be enclosed in parentheses. Each option isspecified as a name = value pair and each pair is space separated.

Interaction: This option is ignored if the axis type is not DISCRETE.

TICKVALUEFITPOLICY=ROTATE | other-policyspecifies a policy for avoiding tick value collision on a column axis.

Default: ROTATE

The following fit policies are available:

ROTATE Tick values are rotated 45 degrees.ROTATETHIN Attempt ROTATE policy and then THIN

policy.

Example Program and Statement Details 443

Page 454: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

STAGGER Tick values alternate between two rows.STAGGERROTATE Attempt STAGGER policy and then

ROTATE policy.STAGGERTHIN Attempt STAGGER policy and then

THIN policy.STAGGERTRUNCATE Attempt STAGGER policy and then

TRUNCATE policy.TRUNCATE Tick values are shortened when they

exceed a certain number of characters.TRUNCATEROTATE Attempt TRUNCATE policy and then

ROTATE policy.TRUNCATESTAGGER Attempt TRUNCATE policy and then

STAGGER policy.TRUNCATETHIN Attempt TRUNCATE policy and then

THIN policy.THIN Some tick values are removed.

Options for Linear Axes OnlyLINEAROPTS=( linear-axis-options )

specifies one or more linear-axis-options for a numeric interval axis. Options must beenclosed in parentheses. Each option is specified as a name = value pair and each pairis space separated.

Interaction: This option is ignored if the axis type is not LINEAR.

Linear-Axis-Option Description

INTEGER Specifies that evenly spaced integer values areused for tick marks.

THRESHOLDMAX Specifies a bias for including one more tickmark at the maximum end of the axis.

THRESHOLDMIN Specifies a bias for including one more tickmark at the minimum end of the axis.

TICKVALUEFITPOLICY Specifies a policy for avoiding tick valuecollision on an X or X2 axis. This option is notavailable in the ROWAXIS statement.

TICKVALUEFORMAT Specifies how to format the values for majortick marks.

TICKVALUELIST Specifies the order of the tick values for a linearaxis as list.

TICKVALUEPRIORITY Specifies whether an axis tick specification canextend the axis data range.

TICKVALUESEQUENCE Specifies the tick values for a linear axis bystart, end, and increment.

444 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 455: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Linear-Axis-Option Description

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

INTEGER=booleanspecifies that evenly spaced integer values are used for tick marks.

Default: FALSE

Interaction: This option is overridden by the TICKVALUELIST= orTICKVALUESEQUENCE= option.

Interaction: This option overrides the MAXDECIMALS= andPREFERREDDECIMALS= suboptions of the TICKVALUEFORMAT= option

THRESHOLDMAX= numberspecifies a bias for including one more tick mark at the maximum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

THRESHOLDMIN= numberspecifies a bias for including one more tick mark at the minimum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

TICKVALUEFITPOLICY=THIN | other-policyspecifies an ordered list of strategies to avoid tick value collision on an X or X2 axis.This option is not available in the ROWAXIS statement.

Default: THIN

The fit policy can be any one of the following:

THIN Eliminate alternate tick values. Available forthe COLUMNAXIS but not for theROWAXIS.

ROTATE Tick values are rotated 45 degrees.

ROTATETHIN Attempt ROTATE policy and then THINpolicy.

STAGGER Tick values alternate between two columns.

Example Program and Statement Details 445

Page 456: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

STAGGERROTATE Attempt STAGGER policy and thenROTATE policy.

STAGGERTHIN Attempt STAGGER policy and then THINpolicy.

If more than one strategy is used, the values in the list are formatted according to theTICKVALUEFORMAT= option.

TICKVALUEFORMAT=( format-options ) | DATA | formatspecifies how to format the values for major tick marks.

Default: ( MAXWIDTH=8, MAXDECIMALS=6, PREFERREDDECIMALS=2,EXTRACTSCALE=FALSE)

(format-options)specifies one or more major tick value formatting options. Together, these optionsprovide parameters for determining an optimal format ( w.d, Ew., BESTw.) fordisplaying major tick values.

MAXWIDTH = integer Specifies the maximum width fordisplayed tick values. Values might berounded or converted to E-notation to fitinto this width.

MAXDECIMALS = integer Specifies the maximum number ofdecimals for displayed tick values.Values might be rounded or converted toE-notation to fit into this width.MAXWIDTH > MAXDECIMALS

PREFERREDDECIMALS = integer Specifies the number of decimal placesdesired for most values. The actualnumber might vary based on otherconstraints.

EXTRACTSCALE = boolean Specifies whether to extract some factorof ten from all tick values in order toreduce the overall width of the tick valuesand improve legibility. The extractedfactor is concatenated to the existing axislabel. Example of revised axis label:Number Sold (x1000)

DATAuse the format that has been assigned to the variable(s) contributing to the axis (orBEST6. if no format is assigned) to control the formatting of the major tick values.

formatuse this format to control how the major tick values are formatted.

Restriction: The format-options are used only when no format has been assigned tothe variable(s) that contribute to the axis or when the assigned format(s) are w.d, Ew.or BESTw.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: If the axis label is not displayed, the EXTRACTSCALE=TRUE format-option is ignored.

446 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 457: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TICKVALUELIST=( numeric-list )specifies the tick values for a linear axis as list.

Default: An internal algorithm determines the tick marks based on the actual axis datarange or the data range established by the VIEWMIN= and VIEWMAX= options. Bydefault when this option is used, the only tick values that appear are those in numeric-list that fall within the explicit data range (set by VIEWMIN= and VIEWMAX=) orimplicit data range (set by the actual data minimum and data maximum).

Requirement: The numeric-list must be enclosed in parentheses and each itemseparated by a blank.

Interaction: This option overrides the INTEGER=

Interaction: This option is ignored if the TICKVALUESEQUENCE= option isspecified, or if the DISPLAY= or DISPLAYSECONDARY= option does not displaythe tick values.

Interaction: The VIEWMIN= and VIEWMAX= options alter the axis data range. Ifthe VIEWMIN= option is set to the minimum tick list value and the VIEWMAX=option is set to the maximum tick list value, all ticks in the tick list are displayed.

Interaction: If the TICKVALUEPRIORITY= is set to TRUE, 1) the VIEWMIN= andVIEWMAX= options are ignored if they are fully enclosed by the numeric-list, and 2)the tick numeric-list can extend the implicit data range of the axis, but never reduce it.

The values in the list are formatted according to the setting for theTICKVALUEFORMAT= option.

TICKVALUEPRIORITY=booleanspecifies whether an axis tick specification (TICKVALUELIST= orTICKVALUESEQUENCE= ) can extend the axis data range.

Default: FALSE.

FALSEthe only tick values that appear are the user-specified tick values that fall within theexplicit data range (set by VIEWMIN= and VIEWMAX= ) or implicit data range(set by the actual data minimum and data maximum).

TRUEthe axis data range might be extended (but not reduced) to include the minimumand maximum specified by either the TICKVALUELIST= orTICKVALUESEQUENCE= option. If minimum and maximum of the user-specified values are within the data range, this option has no effect.

Interaction: When this option is set to TRUE, the VIEWMIN= and VIEWMAX=options are ignored if they are fully enclosed by value range set by theTICKVALUELIST= or TICKVALUESEQUENCE= option.

Interaction: This option is ignored if the DISPLAY= or DISPLAYSECONDARY=option does not display the tick values.

TICKVALUESEQUENCE=( sequence-options )specifies the tick values for a linear axis by start, end, and increment.

Default: An internal algorithm determines the tick marks based on the actual axis datarange or the data range established by the VIEWMIN= and VIEWMAX= options. Bydefault when this option is used, the only tick values that appear are those that fallwithin the explicit data range (set by VIEWMIN= and VIEWMAX=) or implicit datarange (set by the actual data minimum and data maximum).

(sequence-options)Three settings that control major tick values. All three must be provided.

Example Program and Statement Details 447

Page 458: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

START = number Specifies the value for the first tick mark.END = number Specifies the value for the last tick mark.INCREMENT = number Specifies the increment for intermediate

tick marks between the first and last tickmarks. The END value always controlsthe last tick mark. The interval betweenthe last tick mark and the previous tickmark might not necessarily be theINCREMENT value.

Interaction: This option overrides the INTEGER= option.

Interaction: The VIEWMIN= and VIEWMAX= options alter the axis data range. Ifthe VIEWMIN= option is set to the START= option value and the VIEWMAX= optionis set to the END= option value, all ticks in the tick sequence are displayed.

Interaction: If the TICKVALUEPRIORITY= option is set to TRUE, the tick sequencemight extend the explicit data range of the axis, but never reduce it.

Interaction: This option is ignored if the DISPLAY= or DISPLAYSECONDARY=option does not display tick marks.

The values in the sequence are formatted according to the setting for theTICKVALUEFORMAT= option.

See also: TICKVALUELIST= option as an alternative for customizing tick marks.

VIEWMAX= numberspecifies the maximum data value to include in the display (the value might be adjustedby the threshold calculation). For more information, see “Adjusting the Axis View” onpage 402.

Default: The maximum value in the data for the specified axis.

Interaction: This option does not determine the maximum axis tick value displayed.The THRESHOLDMAX= value is used to determine the maximum tick value.

Interaction: This option has no effect if the TICKVALUEPRIORITY= is set to TRUE.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display (the value might be adjustedby the threshold calculation). For more information, see “Adjusting the Axis View” onpage 402.

Default: The minimum value in the data for the specified axis.

Interaction: This option does not determine the minimum axis tick value displayed.The THRESHOLDMIN= value is used to determine the maximum tick value.

Interaction: This option has no effect if the TICKVALUEPRIORITY= is set to TRUE.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

448 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 459: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Options for Log Axes OnlyLOGOPTS=( log-axis-options )

specifies one or more log-axis-options for a log axis. Options must be enclosed inparentheses. Each option is specified as a name = value pair and each pair is spaceseparated.

Interaction: This option is ignored if the axis type is not LOG.

Log-Axis-Option Description

BASE Specifies the base of the logarithmic scale forthe axis values.

MINORTICKS Specifies whether minor ticks are displayed.

TICKINTERVALSTYLE Specifies how to scale and format the values formajor tick marks.

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

BASE=10 | 2 | Especifies the base of the logarithmic scale for the axis values.

Default: 10

MINORTICKS=booleanspecifies whether minor ticks are displayed:

Default: FALSE

Restriction: Minor ticks can be displayed only when BASE=10 andTICKINTERVALSTYLE= is LOGEXPAND or LOGEXPONENT.

If this option is set to TRUE, the number of minor ticks is automatically determined.

TICKINTERVALSTYLE=AUTO | LOGEXPAND | LOGEXPONENT | LINEARspecifies how to scale and format the values for major tick marks.

Default: AUTO

AUTOA LOGEXPAND, LOGEXPONENT, or LINEAR representation is chosenautomatically based on the range of the data. When the data range is small (withinan order of magnitude), a LINEAR representation is typically used. Data rangesthat encompass several orders of magnitude typically use the LOGEXPAND orLOGEXPONENT representation.

LOGEXPANDMajor ticks are placed at uniform intervals at integer powers of the base. The tickvalues are expanded as follows:

Example Program and Statement Details 449

Page 460: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Base=10

Base=2

Base=E

LOGEXPONENTMajor ticks are placed at uniform intervals at integer powers of the base. The tickvalues are only the integer exponents for all bases.

LINEARMajor tick marks are placed at non-uniform intervals that cover the range of thedata.

Restriction: For LOGEXPAND and LOGEXPONENT, formats on data columnscontributing to the axis are ignored. For LINEAR, ticks values are automaticallyformatted when the column format is not assigned or one of w.d, Ew. or BESTw. Otherformats (SAS defined or user-defined) are used if specified.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: When BASE=10 and LOGEXPAND or LOGEXPONENT is used, anintermediate tick is added whenever the axis data range is less than or equal to 1.5powers of 10.

If you use TICKINTERVALSTYLE=LOGEXPONENT, you might want to includeinformation in the axis label about which base is used.

VIEWMAX= numberspecifies the maximum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The maximum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The minimum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

Options for Time Axes OnlyTIMEOPTS=( time-axis-options )

specifies one or more time-axis-options for a time axis.

Variables associated with a time axis must be in SAS time, SAS date, or SAS datetimeunits and have an associated SAS time, date, or datetime format.

Options must be enclosed in parentheses. Each option is specified as a name = valuepair and each pair is space separated.

450 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 461: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option is ignored if the axis type is not TIME.

Time-Axis-Option Description

INTERVAL Specifies the time interval between major tickmarks.

MINORTICKS Specifies whether minor tick marks aredisplayed.

SPLITTICKVALUE Specifies whether to split the tick values oncolumn axes, if possible. This option is notavailable in the ROWAXIS statement.

TICKVALUEFITPOLICY Specifies a policy for avoiding tick valuecollision on column axes. This option is notavailable in the ROWAXIS statement.

TICKVALUEFORMAT Specifies how to format the values for majortick marks.

TICKVALUELIST Specifies the order of the tick values for a timeaxis as list.

TICKVALUEPRIORITY Specifies whether an axis tick specification canextend the axis data range.

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

INTERVAL=intervalspecifies the time interval between major ticks. Valid interval keywords are AUTO,SECOND, MINUTE, HOUR, DAY, TENDAY, WEEK, SEMIMONTH, MONTH,QUARTER, SEMIYEAR, YEAR.

The data column(s) mapped to a time axis must be in the same duration units: TIME,DATE, or DATETIME. The selection of an interval must be consistent with theduration unit. For example, if the data are in time units, you can select only AUTO,SECOND, MINUTE, HOUR.

Default: AUTO. An appropriate interval is chosen based on the data.

Interaction: This option is ignored if the TICKVALUELIST= option is used.

INTERVAL Unit Tick intervalDefault tick valueformat

AUTO DATE, TIME, orDATETIME

automaticallychosen

automaticallychosen

SECOND TIME orDATETIME

second TIME8.

Example Program and Statement Details 451

Page 462: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

INTERVAL Unit Tick intervalDefault tick valueformat

MINUTE TIME orDATETIME

minute TIME8.

HOUR TIME orDATETIME

hour TIME8.

DAY DATE orDATETIME

day DATE9.

TENDAY DATE orDATETIME

10 days DATE9.

WEEK DATE orDATETIME

7 days DATE9.

SEMIMONTH DATE orDATETIME

1st and 16th of eachmonth

DATE9.

MONTH DATE orDATETIME

month MONYY7.

QUARTER DATE orDATETIME

3 months YYQC6.

SEMIYEAR DATE orDATETIME

6 months MONYY7.

YEAR DATE orDATETIME

year YEAR4.

MINORTICKS=booleanspecifies whether minor tick marks are displayed.

Default: FALSE

Interaction: The number of minor ticks is dependent on the value of the INTERVAL=option. For example, on a row axis, if INTERVAL=YEAR, there would be four minorticks (one per quarter).

Interaction: This option is ignored if the TICKVALUELIST= option is used, or if theDISPLAY= or DISPLAYSECONDARY= option does not display the tick marks.

SPLITTICKVALUE=booleanspecifies whether to split the tick values on column axes, if possible (this option is notavailable in the ROWAXIS statement). For example, with INTERVAL=MONTH, thisis how tick values are split:

Default: TRUE

TRUEaxis tick values are split into two lines allowing more tick values to appear

452 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 463: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

FALSEtypically, fewer tick values fit, causing thinning, rotation, or staggering of thevalues. See the TICKVALUEFITPOLICY= option.

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUEFORMAT= option is specified.

TICKVALUEFITPOLICY=THIN | ROTATE | ROTATETHIN | STAGGER |STAGGERROTATE | STAGGERTHIN

specifies a policy for avoiding tick value collision on column axes. This option is notavailable in the ROWAXIS statement.

Default: THIN

The fit policy can be any one of the following policies:

THIN Some tick values are removed.

ROTATE Tick values are rotated 45 degrees.

ROTATETHIN Attempt ROTATE policy and then THINpolicy.

STAGGER Tick values alternate between two columns.

STAGGERROTATE Attempt STAGGER policy and thenROTATE policy.

STAGGERTHIN Attempt STAGGER policy and then THINpolicy.

Interaction: When SPLITTICKVALUE= TRUE, this option is ignored and only theTHIN policy is used.

TICKVALUEFORMAT=format | DATAspecifies how to format the values for major tick marks.

Default: The default format used by the INTERVAL= option. The default does notapply if TICKVALUELIST= is specified.

formatA SAS date, time, or datetime format to control how the major tick values aredisplayed. This format should be in the same duration units as the data column(s)mapped to a time axis: TIME, DATE, or DATETIME, and should be appropriatefor the value of the INTERVAL= option. For example, if INTERVAL=MONTHand there are two years of data displayed on the axis, choosingTICKVALUEFORMAT=YEAR. would result in several ticks having the sameyear value.

DATAUse the SAS date, time, or datetime format associated with the data column assignedto the axis to control how the major tick values are displayed.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: If this option is specified, the SPLITTICKVALUE= option is ignored.

Example Program and Statement Details 453

Page 464: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TICKVALUELIST=( time-constant-list | date-constant-list | datetime-constant-list |numeric-list )

specifies the tick values for a time axis as list.

Default: An internal algorithm determines the tick values.

Requirement: The list must be enclosed in parentheses and each item separated by ablank. The items in the list must be in the same duration units as the data mapped tothe axis: TIME, DATE, or DATETIME. The values can be expressed as SAS TIME,DATE, or DATETIME constants (for example, "13:23"T, "11MAY06"D, or"11MAY06:13:23"DT) or their numeric equivalents.

Restriction: If TICKVALUEPRIORITY= is set to FALSE, this option does not extendthe data range of the axis. If the values fall within the default data range or that specifiedby the VIEWMIN= or VIEWMAX= options, they are used.

The values in the list are formatted according to the setting for theTICKVALUEFORMAT= option. If TICKVALUEFORMAT= is not used, the valuesare formatted according to the column format (the default TICKVALUEFORMATvalue is not applied to these values).

See also: TICKVALUESEQUENCE= option as an alternate to customizing tick marks.

TICKVALUEPRIORITY=booleanspecifies whether an axis tick specification (TICKVALUELIST= ) can extend the axisdata range.

Default: FALSE

FALSEthe only tick values that appear are the user-specified tick values that fall within theexplicit data range (set by VIEWMIN= and VIEWMAX= ) or implicit data range(set by the actual data minimum and data maximum).

TRUEthe axis data range might be extended (but not reduced) to include the minimumand maximum specified by the TICKVALUELIST= option. If minimum andmaximum of the user-specified values are within the data range, this option has noeffect.

Interaction: When this option is set to TRUE, the VIEWMIN= or VIEWMAX=options might have no effect.

Interaction: This option is ignored if the DISPLAY= or DISPLAYSECONDARY=option does not display tick marks.

VIEWMAX= numberspecifies the maximum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The maximum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The minimum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

454 Chapter 44 • Axis Options for LAYOUT LATTICE

Page 465: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 45

Axis Options for LAYOUTOVERLAYEQUATED

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455Options That Apply in Common to Both Equated Axes . . . . . . . . . . . . . . . . . . . . 456Options That Apply Separately to an X or Y Equated Axis . . . . . . . . . . . . . . . . . . 459

Description and SyntaxAxis options for the plots within an OVERLAYEQUATED layout are specified with thefollowing options on a LAYOUT OVERLAYEQUATED statement:

COMMONAXISOPTS= (common-equated-axis-options)

XAXISOPTS= (equated-axis-options)

YAXISOPTS= (equated-axis-options)

Example Program and Statement Details

OverviewThe LAYOUT OVERLAYEQUATED statement is used for equated layouts where the Xand Y axes always have equal increments between tick values. Because the axes within theequated layout are so closely correlated, some axis adjustments cannot be applied to oneaxis without applying them to the other.

For example, the INTEGER= option sets evenly spaced integer values for the axis tickmarks. That setting must be applied to both axes if the correlation between them is to bemaintained. The LAYOUT OVERLAYEQUATED statement provides theCOMMONAXISOPTS= option for specifying the INTEGER= option and other optionswhose settings apply in common to both axes.

Despite the close correlation between the axes, some axis adjustments can be made to oneaxis without affecting the other. For example, displaying grid lines on one axis has noimpact on the other. The XAXISOPTS= and YAXISOPTS= options are available forapplying settings separately to the X and Y axes.

455

Page 466: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The following example template sets evenly spaced integer values for the axis tick marksof both axes. It also specifies the display of grid lines, tick marks, and tick values for theY axis:

begingraph; layout overlayequated / commonaxisopts=(integer=true); yaxisopts=(griddisplay=on display=(ticks tickvalues)); seriesplot x=var1 y=var2; endlayout;endgraph;

Interaction. The OVERLAYEQUATED’s axis options are ignored when the LAYOUTOVERLAYEQUATED statement is nested within another layout type that has externalaxes in effect. For example, the axis options are ignored when the statement is nested withina LAYOUT LATTICE with a COLUMNAXIS= or ROWAXIS= option in effect.

Options That Apply in Common to Both Equated AxesThe options that are documented in this section are applied to both axes and cannot beapplied separately to an X or Y axis. See “Options That Apply Separately to an X or YEquated Axis” on page 459 for a list of options that can be applied to a single axis.

COMMONAXISOPTS= ( common-equated-axis-options )specifies one or more options to apply to both the X and Y equated axes. Options mustbe enclosed in parentheses. Each option is specified as a name = value pair and eachpair is space separated.

Equated-Axis-Option Description

INTEGER Specifies that evenly spaced integer values areused for tick marks for all axes.

TICKSTYLE Specifies the placement of tick marks in relationto the axis line.

TICKVALUELIST Specifies the order of the tick values as list.

TICKVALUEPRIORITY Specifies whether an axis tick specification canextend the axis data range.

TICKVALUESEQUENCE Specifies the tick values by start, end, andincrement.

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

INTEGER=booleanspecifies that evenly spaced integer values are used for tick marks for all axes.

Default: FALSE

Interaction: This option is overridden by the TICKVALUELIST= orTICKVALUESEQUENCE= option.

456 Chapter 45 • Axis Options for LAYOUT OVERLAYEQUATED

Page 467: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option overrides the MAXDECIMALS= andPREFERREDDECIMALS= suboptions of the TICKVALUEFORMAT= option onXAXISOPTS= or YAXISOPTS=.

TICKSTYLE=OUTSIDE | INSIDE | ACROSSspecifies the placement of tick marks in relation to the axis line. The figure shows thetick display on an X axis.

Default: OUTSIDE

OUTSIDEdisplays tick marks outside of the axis line.

INSIDEdisplays tick marks inside of the axis line.

ACROSSdisplays tick marks across the axis line.

Interaction: This option is ignored if the ticks are not displayed. See the DISPLAY=and DISPLAYSECONDARY= suboptions of XAXISOPTS= and YAXISOPTS=.

This option has no affect on the placement of the tick values, which are always outsidethe axis line.

TICKVALUELIST=( numeric-list )specifies the tick values as a list.

Default: An internal algorithm determines the tick marks based on the actual axis datarange or the data range established by the VIEWMIN= and VIEWMAX= options. Bydefault when this option is used, the only tick values that appear are the numeric-listtick values that fall within the explicit data range (set by VIEWMIN= andVIEWMAX=) or implicit data range (set by the actual data minimum and datamaximum).

Requirement: The numeric-list must be enclosed in parentheses and each itemseparated by a blank.

Interaction: This option overrides the INTEGER= option.

Interaction: This option is ignored if the LAYOUT OVERLAYEQUATED statementspecifies EQUATETYPE=FIT (the default).

Interaction: This option is ignored if the TICKVALUESEQUENCE= option isspecified, or if the DISPLAY= option does not display tick values.

Interaction: The VIEWMIN= and VIEWMAX= options alter the axis data range. Ifthe VIEWMIN= option is set to the minimum tick list value and the VIEWMAX=option is set to the maximum tick list value, all ticks in the tick list are displayed.

Interaction: If the TICKVALUEPRIORITY= is set to TRUE, 1) the VIEWMIN= andVIEWMAX= options are ignored if they are fully enclosed by the numeric-list 2) thetick numeric-list can extend the implicit data range of the axis, but never reduce it.

The values in the list are formatted according to the setting for theTICKVALUEFORMAT= option on XAXISOPTS= or YAXISOPTS=.

TICKVALUEPRIORITY=booleanspecifies whether an axis tick specification (TICKVALUELIST= orTICKVALUESEQUENCE=) can extend the axis data range.

Example Program and Statement Details 457

Page 468: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: FALSE

FALSEthe only tick values that appear are the user-specified tick values that fall within theexplicit data range (set by VIEWMIN= and VIEWMAX= ) or implicit data range(set by the actual data minimum and data maximum).

TRUEthe axis data range might be extended (but not reduced) to include the minimumand maximum specified by either the TICKVALUELIST= orTICKVALUESEQUENCE= option. If minimum and maximum of the user-specified values are within the data range, this option has no effect.

Interaction: When this option is set to TRUE, the VIEWMIN= and VIEWMAX=options are ignored if they are fully enclosed by value range set by theTICKVALUELIST= or TICKVALUESEQUENCE= option.

Interaction: This option is ignored if the DISPLAY= option does not display tickmarks.

TICKVALUESEQUENCE=( sequence-options )specifies the tick values by start, end, and increment.

Default: An internal algorithm determines the tick marks based on the actual axis datarange or the data range established by the VIEWMIN= and VIEWMAX= options. Bydefault when this option is used, the only tick values that appear are those that fallwithin the explicit data range (set by VIEWMIN= and VIEWMAX=) or implicit datarange (set by the actual data minimum and data maximum).

(sequence-options)Three options that control tick values. All three options must be provided.

START = number Specifies the value for the first tick mark.END = number Specifies the value for the last tick mark.INCREMENT = number Specifies the increment for intermediate

tick marks between the first and last tickmarks. The END value always controlsthe last tick mark. The interval betweenthe last tick mark and the previous tickmark might not necessarily be theINCREMENT value.

Interaction: This option is ignored if the LAYOUT OVERLAYEQUATED statementspecifies EQUATETYPE=FIT (the default), or if the DISPLAY= option does notdisplay tick marks.

Interaction: This option overrides the INTEGER= option.

Interaction: The VIEWMIN= and VIEWMAX= options alter the axis data range. Ifthe VIEWMIN= option is set to the START= option value and the VIEWMAX= optionis set to the END= option value, all ticks in the tick sequence are displayed.

Interaction: If the TICKVALUEPRIORITY= option is set to TRUE, the tick sequencemight extend the explicit data range of the axis, but never reduce it.

The values in the sequence are formatted according to the setting for theTICKVALUEFORMAT= option on XAXISOPTS= or YAXISOPTS=.

See also: TICKVALUELIST= option as an alternative for customizing tick marks.

458 Chapter 45 • Axis Options for LAYOUT OVERLAYEQUATED

Page 469: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

VIEWMAX= numberspecifies the maximum data value to include in the display (the value might be adjustedby the threshold calculation). For more information, see “Adjusting the Axis View” onpage 402.

Default: The maximum value in the data for the specified axis.

Interaction: This option does not determine the maximum axis tick value displayed.The THRESHOLDMAX= value is used to determine the maximum tick value.

Interaction: This option has no effect if the TICKVALUEPRIORITY= is set to TRUE.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display (the value might be adjustedby the threshold calculation). For more information, see “Adjusting the Axis View” onpage 402.

Default: The minimum value in the data for the specified axis.

Interaction: This option does not determine the minimum axis tick value displayed.The THRESHOLDMIN= value is used to determine the maximum tick value.

Interaction: This option has no effect if the TICKVALUEPRIORITY= is set to TRUE.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

Options That Apply Separately to an X or Y Equated AxisThe options that are documented in this section can be applied to an X axis with theXAXISOPTS= option, or to the Y axis with the YAXISOPTS= option. See “Options ThatApply in Common to Both Equated Axes” on page 456 for a list of options that apply incommon to both axes.

XAXISOPTS= ( equated-axis-options ), YAXISOPTS= ( equated-axis-options )each option specifies one or more options for an equated axis. Options must be enclosedin parentheses. Each option is specified as a name = value pair and each pair is spaceseparated.

Equated-Axis-Option Description

DISPLAY Controls which axis features are displayed onthe primary axis.

DISPLAYSECONDARY Controls which axis features are displayed onthe secondary axis.

GRIDATTRS Specifies the attributes of the grid lines.

GRIDDISPLAY Specifies when axis grid lines are displayed.

LABEL Specifies the axis label.

LABELATTRS Specifies the color and font attributes of the axislabel.

Example Program and Statement Details 459

Page 470: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Equated-Axis-Option Description

OFFSETMAX Reserves an area at the maximum end of theaxis. No tick marks are displayed in the reservedarea.

OFFSETMIN Reserves an area at the minimum end of theaxis. No tick marks are displayed in the reservedarea.

SHORTLABEL Specifies an alternate axis label to use if thedefault or specified axis label is too long for theaxis length.

THRESHOLDMAX Specifies a bias for including one more tickmark at the maximum end of the axis.

THRESHOLDMIN Specifies a bias for including one more tickmark at the minimum end of the axis.

TICKVALUEATTRS Specifies the color and font attributes of the axistick values.

TICKVALUEFITPOLICY Specifies a policy for avoiding tick valuecollision. Only the default policy (THIN) isavailable for a Y or Y2 axis.

TICKVALUEFORMAT Specifies how to format the values for tickmarks.

DISPLAY=STANDARD | ALL | NONE | ( display-options )controls which axis features are displayed on the primary axis.

Default: STANDARD

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed

NONEspecifies that no axis features are displayed

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL displays the axis labelLINE displays the axis lineTICKS displays the tick marksTICKVALUES displays the values that are represented by

the tick marks

The default line attributes for the axis line and axis tick marks are defined in theGraphAxisLine style element.

See GRIDDISPLAY= and GRIDATTRS= for setting axis grid lines.

460 Chapter 45 • Axis Options for LAYOUT OVERLAYEQUATED

Page 471: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DISPLAYSECONDARY=NONE | ALL | STANDARD | ( display-options )controls which axis features are displayed on the secondary axis. When data are mappedto the X or Y axis, you can display an X2 or Y2 (secondary) axis using this option. Thesecondary axis is a duplicate of the X or Y axis but can have different display options.

Default: NONE

NONEspecifies that no axis features are displayed

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL displays the axis labelLINE displays the axis lineTICKS displays the tick marksTICKVALUES displays the values that are represented by

the tick marks

GRIDATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the grid lines. See “General Syntax for Attribute Options” onpage 563 for the syntax on using a style-element and “Line Options” on page 564 foravailable line-options.

Default: The GraphGridLines style element.

Interaction: This option is ignored if the GRIDDISPLAY= option does not displaythe grid lines.

GRIDDISPLAY=AUTO_OFF | AUTO_ON | ON | OFFspecifies when axis grid lines are displayed.

Default: AUTO_OFF

AUTO_OFFspecifies that grid lines are not displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="ON."

AUTO_ONspecifies that grid lines are displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="OFF."

ONspecifies that grid lines are always displayed. The current style has no override.

OFFspecifies that grid lines are never displayed. The current style has no override.

This option enables the template to absolutely control the display of grid lines or toallow interaction with the current style to decide whether grid lines are displayed.

Supplied styles use DisplayOpts="AUTO," which means that the style has no"preference" about grid lines and the graphics template setting for grid lines is alwaysused.

Example Program and Statement Details 461

Page 472: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Discussion: The following table shows the end results for various combinations of theGRIDDISPLAY= option and the DisplayOpts= attribute of the GraphGridLines styleelement. Most supplied templates use the default setting AUTO_OFF to indicate apreference for not displaying grid lines, but allowing the style to override.

GRIDDISPLAY= optionDisplayOpts= styleattribute Grid Lines Shown?

AUTO_OFF AUTO no

AUTO_OFF ON yes

AUTO_OFF OFF no

AUTO_ON AUTO yes

AUTO_ON ON yes

AUTO_ON OFF no

ON any value yes

OFF any value no

LABEL="string" | ( "string" …"string" )specifies the axis label. The string can be either a string literal or a dynamic. The listform implies that all included string literals or dynamics will be concatenated

Default: The default label is derived from the primary plot in the layout. For moreinformation, see “When Plots Share Data and a Common Axis” on page 397.

Interaction: If the axis label is too long to fit along the axis, it is truncated by default.Use the SHORTLABEL= option to specify an alternate axis label to be used whenevertruncation would normally occur.

Interaction: This option is ignored if the DISPLAY= option does not display the axislabel.

LABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis label. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options” onpage 566 for available text-options.

Default: The GraphLabelText style element.

Interaction: This option is ignored if the DISPLAY= option does not display the axislabel.

OFFSETMAX=AUTO | AUTOCOMPRESS | numberreserves an area at the maximum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTO

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe maximum end of an axis.

462 Chapter 45 • Axis Options for LAYOUT OVERLAYEQUATED

Page 473: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

AUTOCOMPRESSAutomatic offset applied that prevents axis labels and tick values from extendingbeyond the axis length.

numberThe offset is expressed as a decimal proportion of the full axis length.

OFFSETMIN=AUTO | AUTOCOMPRESS | numberreserves an area at the minimum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTO

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe maximum end of an axis.

AUTOCOMPRESSAutomatic offset applied that prevents axis labels and tick values from extendingbeyond the axis length.]

numberThe offset is expressed as a decimal proportion of the full axis length.

SHORTLABEL="string"specifies an alternate axis label. This label is used when the default axis label or labelspecified by the LABEL= option is too long for the axis length.

Default: no default

Interaction: This option is ignored if the DISPLAY= option does not display the axislabel.

If the specified label is itself too long for the axis, it is truncated in the display.

THRESHOLDMAX= numberspecifies a bias for including one more tick mark at the maximum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

THRESHOLDMIN= numberspecifies a bias for including one more tick mark at the minimum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

TICKVALUEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis tick values. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Example Program and Statement Details 463

Page 474: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option is ignored if the DISPLAY= option does not display tickvalues.

TICKVALUEFITPOLICY=policyspecifies an ordered list of strategies to avoid tick value collision. Only the defaultsetting (THIN) is available for a Y or Y2 axis.

Default: THIN

The collision-avoidance policy that is most effective depends on the number of tickvalues, their length, and the length of the axis. For an X or X2 axis, the policy can beone of the following:

THIN Eliminate alternate tick values.

ROTATE Tick values are rotated 45 degrees.

ROTATETHIN Attempt ROTATE policy and then THINpolicy.

STAGGER Tick values alternate between two rows.

STAGGERROTATE Attempt STAGGER policy and thenROTATE policy.

STAGGERTHIN Attempt STAGGER policy and then THINpolicy.

TICKVALUEFORMAT=( format-options ) | DATA | formatspecifies how to format the values for tick marks.

Default: ( MAXWIDTH=8, MAXDECIMALS=6, PREFERREDDECIMALS=2,EXTRACTSCALE=FALSE)

(format-options)specifies one or more tick value formatting options. Together, these options provideparameters for determining an optimal format ( w.d, Ew., BESTw.) for displayingtick values.

MAXWIDTH = integer Specifies the maximum width fordisplayed tick values. Values might berounded or converted to E-notation to fitinto this width.

MAXDECIMALS = integer Specifies the maximum number ofdecimals for displayed tick values.Values might be rounded or converted toE-notation to fit into this width.MAXWIDTH > MAXDECIMALS

PREFERREDDECIMALS = integer Specifies the number of decimal placesdesired for most values. The actualnumber might vary based on otherconstraints.

EXTRACTSCALE = boolean Specifies whether to extract some factorof ten from all tick values in order toreduce the overall width of the tick valuesand improve legibility. The extractedfactor is concatenated to the existing axis

464 Chapter 45 • Axis Options for LAYOUT OVERLAYEQUATED

Page 475: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

label. Example of revised axis label:Number Sold (x1000)

DATAuse the format that has been assigned to the variable contributing to the axis (orBEST6. if no format is assigned) to control the formatting of the tick values.

formatspecifies a format that controls how the tick values are formatted.

Restriction: The format-options are used only when no format has been assigned tothe variable that contributes to the axis or when the assigned format(s) are w.d, Ew. orBESTw.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: If the axis label is not displayed, the EXTRACTSCALE=TRUE format-option is ignored.

Example Program and Statement Details 465

Page 476: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

466 Chapter 45 • Axis Options for LAYOUT OVERLAYEQUATED

Page 477: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 46

Axis Options for LAYOUTDATALATTICE/DATAPANEL

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469General Options for All Axes in the Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470Options for Discrete X or X2 Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477Options for Linear Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477Options for Log Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482Options for Time Axes Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484

Description and SyntaxAxis options for the plots within DATALATTICE and DATAPANEL layouts are specifiedwith the following options:

COLUMNAXISOPTS= (axis-option(s))

ROWAXISOPTS= (axis-option(s))

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 468:

467

Page 478: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example ProgramThis example shows how axis attributes can be managed separately for even and oddcolumns and rows in the layout grid. In this case, the ROWAXISOPTS= option is used tostagger the Y-axes attributes:

• On the primary (left) Y axis, DISPLAY= displays TICKS and TICKVALUES on thefirst and third rows, while ALTDISPLAY= displays just TICKS on the second row.

• On the secondary (right) Y axis, DISPLAYSECONDARY= displays just TICKS onthe first and third rows, while ALTDISPLAYSECONDARY= displays TICKS andTICKVALUES on the second row.

• This alternating pattern could also have been set for the column axes. The pattern isindependent of the number of rows and columns.

proc template; define statgraph layoutdatalattice; begingraph; entrytitle "Annual Furniture Sales Comparisons"; layout datalattice rowvar=country columnvar=year / rowdatarange=union headerlabellocation=inside headerlabeldisplay=value headerbackgroundcolor=GraphAltBlock:color rowaxisopts=(griddisplay=on display=(tickvalues) altdisplay=(ticks) displaysecondary=(ticks) altdisplaysecondary=(ticks tickvalues) linearopts=(tickvalueformat=dollar12.)) columnaxisopts=(display=(tickvalues) timeopts=(tickvalueformat=monname3.));

468 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 479: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

layout prototype / cycleattrs=true; seriesplot x=month y=TotalActual / name="Actual"; seriesplot x=month y=TotalPredict / name="Predict"; endlayout; sidebar / align=bottom; discretelegend "Actual" "Predict" / border=false; endsidebar; endlayout; endgraph; end;run;

proc summary data=sashelp.prdsal2 nway; class country year month; var actual predict; output out=prdsal2 sum=TotalActual TotalPredict;run;

proc sgrender data=prdsal2 template=layoutdatalattice;run;

Statement SummaryThe LAYOUT DATALATTICE and LAYOUT DATAPANEL statements each create agrid of graphs based on the values of one or more classification variables. In the grid, theaxes are always external and, by default, display information about the left and bottomaxes, called the “primary” axes.

Both the LAYOUT DATALATTICE and LAYOUT DATAPANEL statements haveCOLUMNAXISOPTS= and ROWAXISOPTS= options that manage the axis displayseparately for columns and rows. The display settings that are available can manage oddand even columns and rows separately, enabling you to simplify the axis display withinthe grid.

• To manage the first, third, and odd occurrences of a primary axis, use the DISPLAY=option.

• To manage the second, fourth, and even occurrences of a primary axis, use theALTDISPLAY= option.

To display “secondary” axes on the right or top of the grid, use theDISPLAYSECONDARY= and ALTDISPLAYSECONDARY= options.

In the default cases for the plots within the layout, the axis type is always DISCRETE,LINEAR, or TIME. The TYPE= option enables you to specify an axis type that overridesthe default. For example, when appropriate for the data, you can request a LOG axis. Whenyou override the default axis type, you must be sure to specify the correct axis type for theplot(s) that you are defining.

Each axis type has features specific to that type, and the following axis options enable youto specify features for the different types: DISCRETEOPTS= , LINEAROPTS= ,LOGOPTS= , and TIMEOPTS= . One or more of these options can be specified for anaxis, but the specified settings are applied only to the axis type that supports them.

Note: Certain plot types or layouts sometimes impose restrictions on what type of axis canbe assigned. See the plot or layout documentation for default axis types and anyrestrictions that might apply.

Example Program and Statement Details 469

Page 480: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

General Options for All Axes in the LayoutThe options that are documented in this section can be used with any of the axis types thatare supported within a DATALATTICE or DATAPANEL layout. Subsequent sections inthe chapter document the axis options that are available only for specific axis types:discrete, linear, log, or time axes.

Statement Option Description

ALTDISPLAY Controls which axis features are displayed onsecond, fourth, and other even row or columnoccurrences of the primary axis.

ALTDISPLAYSECONDARY Controls which features are displayed onsecond, fourth, and other even row or columnoccurrences of the secondary axis.

DISCRETEOPTS Specifies options for a discrete axis.

DISPLAY Controls which axis features are displayed onfirst, third, and other odd row or columnoccurrences of the primary axis.

DISPLAYSECONDARY Controls which axis features are displayed onfirst, third, and other odd row or columnoccurrences the secondary axis.

GRIDATTRS Specifies the attributes of the grid lines.

GRIDDISPLAY Specifies whether axis grid lines are displayed.

LABEL Specifies the axis label.

LABELATTRS Specifies the color and font attributes of the axislabel.

LINEAROPTS Specifies options for a standard numericinterval axis.

LOGOPTS Specifies options for a log axis.

OFFSETMAX Reserves an area at the maximum end of theaxis. No tick marks are displayed in the reservedarea.

OFFSETMIN Reserves an area at the minimum end of theaxis. No tick marks are displayed in the reservedarea.

REVERSE Specifies whether the tick values should appearin the reverse order.

SHORTLABEL Specifies an alternate axis label.

470 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 481: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

TICKVALUEATTRS Specifies the color and font attributes of the axistick value labels.

TIMEOPTS Specifies options for a TIME axis.

TYPE Specifies the type of axis to use.

ALTDISPLAY=STANDARD | ALL | NONE | ( display-options )controls which axis features are displayed on second, fourth, and other even row orcolumn occurrences of the primary axis.

Default: The settings on the DISPLAY= option.

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed

NONEspecifies that no axis features are displayed

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL Displays the axis label. A common labelis displayed at the center of the grid, andthe label applies to all the primary axes inthe row or column. This label isoverridden by a label specified on theDISPLAY= option.

LINE Displays the axis line.TICKS Displays the tick marks.TICKVALUES Displays the values that are represented

by the major tick marks.

The default line attributes for the axis line and axis tick marks are defined in theGraphAxisLine style element.

See GRIDDISPLAY= and GRIDATTRS= for setting axis grid lines.

This option can be used to obtain the alternating axis information as seen in aScatterPlotMatrix.

ALTDISPLAYSECONDARY=NONE | ALL | STANDARD | ( display-options )controls which features are displayed on second, fourth, and other even row or columnoccurrences of the secondary axis.

Default: The settings on the DISPLAYSECONDARY= option.

NONEspecifies that no axis features are displayed

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

Example Program and Statement Details 471

Page 482: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL Displays the axis label. A common labelis displayed at the center of the grid, andthe label applies to all the secondary axesin the row or column. This label isoverridden by a label specified on theDISPLAY= option.

LINE Displays the axis line.TICKS Displays the tick marks.TICKVALUES Displays the values that are represented

by the major tick marks.

The secondary axis is a duplicate of the primary axis (the axis to which the data aremapped). It is on the opposite side of the lattice from the primary axis.

The default line attributes for the axis line and axis tick marks are defined in theGraphAxisLine style element.

See GRIDDISPLAY= and GRIDATTRS= for setting axis grid lines.

This option can be used to obtain the alternating axis information as seen in aScatterPlotMatrix.

DISCRETEOPTS=( discrete-axis-options )specifies one or more options for a discrete X or X2 axis. See “Options for Discrete Xor X2 Axes Only” on page 477.

DISPLAY=STANDARD | ALL | NONE | ( display-options )controls which axis features are displayed on first, third, and other odd row or columnoccurrences of the primary axis.

Default: STANDARD

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed

NONEspecifies that no axis features are displayed

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL Displays the axis label. A common labelis displayed at the center of the grid, andthe label applies to all the primary axes inthe row or column. This label overrides alabel specified on the ALTDISPLAY=option.

LINE Displays the axis line.TICKS Displays the tick marks.

472 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 483: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

TICKVALUES Displays the values that are representedby the major tick marks.

The default line attributes for the axis line and axis tick marks are defined in theGraphAxisLine style element.

See GRIDDISPLAY= and GRIDATTRS= for setting axis grid lines.

DISPLAYSECONDARY=NONE | ALL | STANDARD | ( display-options )controls which axis features are displayed on first, third, and other odd row or columnoccurrences of the secondary axis.

Default: NONE

NONEspecifies that no axis features are displayed

STANDARDspecifies that the LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

ALLspecifies that LABEL, LINE, TICKS, and TICKVALUES are displayed on thesecondary axis

(display-options)a list of space-delimited options, enclosed in parentheses. The list must include oneor more of the following:

LABEL Displays the axis label. A common labelis displayed at the center of the grid, andthe label applies to all the secondary axesin the row or column. This label overridesa label specified on theALTDISPLAYSECONDARY= option.

LINE Displays the axis line.TICKS Displays the tick marks.TICKVALUES Displays the values that are represented

by the major tick marks.

The secondary axis is a duplicate of the primary axis (the axis to which the data aremapped). It is on the opposite side of the lattice from the primary axis.

The default line attributes for the axis line and axis tick marks are defined in theGraphAxisLine style element.

See GRIDDISPLAY= and GRIDATTRS= for setting axis grid lines.

GRIDATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the grid lines. See “General Syntax for Attribute Options” onpage 563 for the syntax on using a style-element and “Line Options” on page 564 foravailable line-options.

Default: The GraphGridLines style element.

Interaction: For this option to have any effect, the grid lines must be enabled by theODS style or the GRIDDISPLAY= option.

GRIDDISPLAY=AUTO_OFF | AUTO_ON | ON | OFFspecifies whether axis grid lines are displayed.

Default: AUTO_OFF

Example Program and Statement Details 473

Page 484: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

AUTO_OFFspecifies that grid lines are not displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="ON."

AUTO_ONspecifies that grid lines are displayed unless the GraphGridLines element in thecurrent style contains DisplayOpts="OFF."

ONspecifies that grid lines are always displayed. The current style has no override.

OFFspecifies that grid lines are never displayed. The current style has no override.

This option enables the template to absolutely control the display of grid lines or toallow interaction with the current style to decide whether grid lines are displayed.

Supplied styles use DisplayOpts="AUTO," which means that the style has no"preference" about grid lines and the graphics template setting for grid lines is alwaysused.

Discussion: The following table shows the end results for various combinations of theGRIDDISPLAY= option and the DisplayOpts= attribute of the GraphGridLines styleelement. Most supplied templates use the default setting AUTO_OFF to indicate apreference for not displaying grid lines, but allowing the style to override.

GRIDDISPLAY= option DisplayOpts= style attribute Grid Lines Shown?

AUTO_OFF AUTO no

AUTO_OFF ON yes

AUTO_OFF OFF no

AUTO_ON AUTO yes

AUTO_ON ON yes

AUTO_ON OFF no

ON any value yes

OFF any value no

LABEL="string" | ( "string" …"string" )specifies the axis label. The string can be either a string literal or a dynamic. The listform implies that all included string literals or dynamics will be concatenated

Default: The default label is derived from the primary plot in the layout. For moreinformation, see “When Plots Share Data and a Common Axis” on page 397.

Interaction: If the axis label is too long to fit along the axis, it is truncated by default.Use the SHORTLABEL= option to specify an alternate axis label to be used whenevertruncation would normally occur.

Interaction: For this option to have any effect, the axis label must be enabled by theODS style or the DISPLAY= or DISPLAYSECONDARY= option.

474 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 485: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

LABELATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis label. See “General Syntax for AttributeOptions” on page 563 for the syntax on using a style-element and “Text Options” onpage 566 for available text-options.

Default: The GraphLabelText style element.

Interaction: For this option to have any effect, the axis label must be enabled by theODS style or the DISPLAY= or DISPLAYSECONDARY= option.

LINEAROPTS=( linear-axis-options )specifies one or more linear-axis-options for a numeric interval axis. See “Options forLinear Axes Only” on page 477.

LOGOPTS=( log-axis-options )specifies one or more log-axis-options for a log axis. See “Options for Log Axes Only”on page 482.

OFFSETMAX=AUTO | AUTOCOMPRESS | numberreserves an area at the maximum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTOCOMPRESS

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe maximum end of an axis.

AUTOCOMPRESSAutomatic offset applied that prevents axis labels and tick values from extendingbeyond the axis length.

numberThe offset is expressed as a decimal proportion of the full axis length. For acontinuous axis, the offset follows the highest data value or highest tick value,whichever is greater.

OFFSETMIN=AUTO | AUTOCOMPRESS | numberreserves an area at the minimum end of the axis. No tick marks are displayed in thereserved area. For more information, see “Adjusting Axis Offsets” on page 403.

Default: AUTOCOMPRESS

Range: 0 - 1. The sum of OFFSETMAX= and OFFSETMIN= should not be more than1.

AUTOReserves just enough area to fully display markers and other graphical features nearthe minimum end of an axis.

AUTOCOMPRESSAutomatic offset applied that prevents axis labels and tick values from extendingbeyond the axis length.

numberThe offset is expressed as a decimal proportion of the full axis length. For acontinuous axis, the offset precedes the lowest data value or lowest tick value,whichever is less.

REVERSE=booleanspecifies whether tick values should appear in the reverse order.

Example Program and Statement Details 475

Page 486: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: FALSE

SHORTLABEL="string"specifies an alternate axis label. This label is used when the default axis label or labelspecified by the LABEL= option is too long for the grid length or the grid width.

Default: no default

Interaction: For this option to have any effect, the axis label must be enabled by theODS style or the DISPLAY= or DISPLAYSECONDARY= option.

If the specified label is itself too long for the grid length or the grid width, it is truncatedin the display.

TICKVALUEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the axis tick value labels. See “General Syntaxfor Attribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Interaction: For this option to have any effect, the tick values must be enabled by theODS style or the DISPLAY= or DISPLAYSECONDARY= option.

TIMEOPTS=( time-axis-options )specifies one or more time-axis-options for a time axis. See “Options for Time AxesOnly” on page 484.

TYPE=AUTO | DISCRETE | LINEAR | TIME | LOGspecifies the type of axis to use.

Default: AUTO

AUTORequests that the axis type be automatically determined by the plot or the overlaycontents.

DISCRETEUse a DISCRETE axis if possible. The data for discrete axes can be character ornumeric. You can add a DISCRETEOPTS= ( ) option list to customize this axistype.

LINEARUse a LINEAR axis if possible. You can add a LINEAROPTS= ( ) option list tocustomize this axis type.

TIMEUse a TIME axis if possible. Data for this axis must be SAS time, SAS date, or SASdatetime values. You can add a TIMEOPTS= ( ) option list to customize this axistype.

LOGUse a LOG axis if possible. You can add a LOGOPTS= ( ) option list to customizethis axis type.

Interaction: If this option is set to anything other than AUTO, plots within the layoutare dropped from the display if their data types or data ranges do not match the axistype requirements. For more information, see “Plot Axis Types Must Agree onCommon Axes” on page 400.

Interaction: After the axis type is determined (whether you set a specific type or AUTOis in effect), only options supported by that axis type can be used. For example, ifTYPE=TIME, only the general OVERLAY axis options and those available onTIMEOPTS= are supported.

476 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 487: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Options for Discrete X or X2 Axes OnlyAll settings for discrete axes are set as options on the DISCRETEOPTS= option.

DISCRETEOPTS=( discrete-axis-options )specifies one or more discrete-axis-options for a discrete axis. The discrete-axis-options can be set only for an X or X2 axis. A Y or Y2 axis uses the default THIN fitpolicy. Options must be enclosed in parentheses. Each option is specified as a name =value pair and each pair is space separated.

Interaction: This option is ignored if the axis type is not DISCRETE.

TICKVALUEFITPOLICY=policyspecifies a policy for avoiding tick value collision.

Default: ROTATE

The policy can be any one of the following:

THIN Some tick values are removed.ROTATE Tick values are rotated 45 degrees.ROTATETHIN Attempt ROTATE policy and then THIN

policy.STAGGER Tick values alternate between two rows.STAGGERROTATE Attempt STAGGER policy and then

ROTATE policy.STAGGERTHIN Attempt STAGGER policy and then

THIN policy.STAGGERTRUNCATE Attempt STAGGER policy and then

TRUNCATE policy.TRUNCATE Tick values are shortened when they

exceed a certain number of characters.TRUNCATEROTATE Attempt TRUNCATE policy and then

ROTATE policy.TRUNCATESTAGGER Attempt TRUNCATE policy and then

STAGGER policy.TRUNCATETHIN Attempt TRUNCATE policy and then

THIN policy.

Options for Linear Axes OnlyLINEAROPTS=( linear-axis-options )

specifies one or more options for a numeric interval axis. Options must be enclosed inparentheses. Each option is specified as a name = value pair and each pair is spaceseparated.

Interaction: This option is ignored if the axis type is not LINEAR.

Linear-Axis-Option Description

INTEGER Specifies that evenly spaced integer values areused for tick marks.

Example Program and Statement Details 477

Page 488: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Linear-Axis-Option Description

THRESHOLDMAX Specifies a bias for including one more tickmark at the maximum end of the axis.

THRESHOLDMIN Specifies a bias for including one more tickmark at the minimum end of the axis.

TICKVALUEFITPOLICY Specifies a policy for avoiding tick valuecollision. Only the default policy (THIN) isavailable for a Y or Y2 axis.

TICKVALUEFORMAT Specifies how to format the values for majortick marks.

TICKVALUELIST Specifies the order of the tick values for a linearaxis as list.

TICKVALUEPRIORITY Specifies whether an axis tick specification canextend the axis data range.

TICKVALUESEQUENCE Specifies the tick values for a linear axis bystart, end, and increment.

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

INTEGER=booleanspecifies that evenly spaced integer values are used for tick marks.

Default: FALSE

Interaction: This option is overridden by the TICKVALUELIST= orTICKVALUESEQUENCE= option.

Interaction: This option overrides the MAXDECIMALS= andPREFERREDDECIMALS= suboptions of the TICKVALUEFORMAT= option

THRESHOLDMAX= numberspecifies a bias for including one more tick mark at the maximum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

THRESHOLDMIN= numberspecifies a bias for including one more tick mark at the minimum end of the axis. Formore information, see “Adjusting Axis Thresholds” on page 402.

Default: .30

Range: 0 - 1

478 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 489: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUESEQUENCE= option is used.

TICKVALUEFITPOLICY=THIN | policyspecifies a policy for avoiding tick value collision. Only the default setting (THIN) isavailable for a Y or Y2 axis.

Default: THIN

Restriction: THIN is the only policy supported for the Y or Y2 axis.

If more than one policy is used, the values in the list are formatted according to theTICKVALUEFORMAT= option.

The policy can be any one of the following policies:

THIN Eliminate alternate tick values. Onlyavailable on COLUMNAXIS.

ROTATE Tick values are rotated 45 degrees.

ROTATETHIN Attempt ROTATE policy and then THINpolicy.

STAGGER Tick values alternate between two rows.

STAGGERROTATE Attempt STAGGER policy and thenROTATE policy.

STAGGERTHIN Attempt STAGGER policy and then THINpolicy.

TICKVALUEFORMAT=( format-options ) | DATA | formatspecifies how to format the values for major tick marks.

Default: ( MAXWIDTH=8, MAXDECIMALS=6, PREFERREDDECIMALS=2,EXTRACTSCALE=FALSE)

(format-options)specifies one or more major tick value formatting options. Together, these optionsprovide parameters for determining an optimal format ( w.d, Ew., BESTw.) fordisplaying major tick values.

MAXWIDTH = integer Specifies the maximum width fordisplayed tick values. Values might berounded or converted to E-notation to fitinto this width.

MAXDECIMALS = integer Specifies the maximum number ofdecimals for displayed tick values.Values might be rounded or converted toE-notation to fit into this width.MAXWIDTH > MAXDECIMALS

PREFERREDDECIMALS = integer Specifies the number of decimal placesdesired for most values. The actualnumber might vary based on otherconstraints.

EXTRACTSCALE = boolean Specifies whether to extract some factorof ten from all tick values in order to

Example Program and Statement Details 479

Page 490: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

reduce the overall width of the tick valuesand improve legibility. The extractedfactor is concatenated to the existing axislabel. Example of revised axis label:Number Sold (x1000)

DATAuse the format that has been assigned to the variable(s) contributing to the axis (orBEST6. if no format is assigned) to control the formatting of the major tick values.

formatuse this format to control how the major tick values are formatted.

Restriction: The format-options are used only when no format has been assigned tothe variable(s) that contribute to the axis or when the assigned format(s) are w.d, Ew.or BESTw.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: If the axis label is not displayed, the EXTRACTSCALE=TRUE format-option is ignored.

TICKVALUELIST=( numeric-list )specifies the tick values for a linear axis as list.

Default: An internal algorithm determines the tick marks based on the actual axis datarange or the data range established by the VIEWMIN= and VIEWMAX= options. Bydefault, when this option is used, only tick values that appear are those in numeric-list that fall within the explicit data range (set by VIEWMIN= and VIEWMAX=) orimplicit data range (set by the actual data minimum and data maximum).

Requirement: The numeric-list must be enclosed in parentheses and each itemseparated by a blank.

Interaction: This option overrides the INTEGER= option.

Interaction: This option is ignored if the TICKVALUESEQUENCE= option isspecified, or if the tick values are not enabled by the ODS style or the DISPLAY= orDISPLAYSECONDARY= option.

Interaction: The VIEWMIN= and VIEWMAX= options alter the axis data range. Ifthe VIEWMIN= option is set to the minimum tick list value and the VIEWMAX=option is set to the maximum tick list value, all ticks in the tick list are displayed. Thismight result in some data not being displayed. For example, data might not be displayedwhen the VIEWMIN= value is greater than the actual data minimum, or when theVIEWMAX= value is less than actual data maximum.

Interaction: If the TICKVALUEPRIORITY= is set to TRUE, 1) the VIEWMIN= andVIEWMAX= options are ignored if they are fully enclosed by the numeric-list 2) thetick numeric-list can extend the implicit data range of the axis, but never reduce it.

The values in the list are formatted according to the setting for theTICKVALUEFORMAT= option.

TICKVALUEPRIORITY=booleanspecifies whether an axis tick specification (TICKVALUELIST= orTICKVALUESEQUENCE=) can extend the axis data range.

Default: FALSE

480 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 491: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

FALSEthe only tick values to appear are the user-specified tick values that fall within theexplicit data range (set by VIEWMIN= and VIEWMAX= ) or implicit data range(set by the actual data minimum and data maximum).

TRUEthe axis data range might be extended (but not reduced) to include the minimumand maximum specified by either the TICKVALUELIST= orTICKVALUESEQUENCE= option. If minimum and maximum of the user-specified values are within the data range, this option has no effect.

Interaction: When this option is set to TRUE, the VIEWMIN= and VIEWMAX=options are ignored if they are fully enclosed by value range set by theTICKVALUELIST= or TICKVALUESEQUENCE= option.

Interaction: For this option to have any effect, the tick marks must be enabled by theODS style or the DISPLAY= or DISPLAYSECONDARY= option.

TICKVALUESEQUENCE=( sequence-options )specifies the tick values for a linear axis by start, end, and increment.

Default: An internal algorithm determines the tick marks based on the actual axis datarange or the data range established by the VIEWMIN= and VIEWMAX= options. Bydefault when this option is used, the only tick values to appear are those that fall withinthe explicit data range (set by VIEWMIN= and VIEWMAX=) or implicit data range(set by the actual data minimum and data maximum).

(sequence-options)Three options that control major tick values. All three options must be provided.

START = number Specifies the value for the first tick mark.END = number Specifies the value for the last tick mark.INCREMENT = number Specifies the increment for intermediate

tick marks between the first and last tickmarks. The END value always controlsthe last tick mark. The interval betweenthe last tick mark and the previous tickmark might not necessarily be theINCREMENT value.

Interaction: This option overrides the INTEGER= option.

Interaction: The VIEWMIN= and VIEWMAX= options alter the axis data range. Ifthe VIEWMIN= option is set to the START= option value and the VIEWMAX= optionis set to the END= option value, all ticks in the tick sequence are displayed.

Interaction: If the TICKVALUEPRIORITY= option is set to TRUE, the tick sequencemight extend the explicit data range of the axis, but never reduce it.

Interaction: For this option to have any effect, the tick marks must be enabled by theODS style or the DISPLAY= or DISPLAYSECONDARY= option.

The values in the sequence are formatted according to the setting for theTICKVALUEFORMAT= option.

See also: TICKVALUELIST= option as an alternative for customizing tick marks.

VIEWMAX= numberspecifies the maximum data value to include in the display (the value might be adjustedby the threshold calculation). For more information, see “Adjusting the Axis View” onpage 402.

Default: The maximum value in the data for the specified axis.

Example Program and Statement Details 481

Page 492: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: This option does not determine the maximum axis tick value displayed.The THRESHOLDMAX= value is used to determine the maximum tick value.

Interaction: This option has no effect if the TICKVALUEPRIORITY= is set to TRUE.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display (the value might be adjustedby the threshold calculation). For more information, see “Adjusting the Axis View” onpage 402.

Default: The minimum value in the data for the specified axis.

Interaction: This option does not determine the minimum axis tick value displayed.The THRESHOLDMIN= value is used to determine the maximum tick value.

Interaction: This option has no effect if the TICKVALUEPRIORITY= is set to TRUE.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

Options for Log Axes OnlyLOGOPTS=( log-axis-options )

specifies one or more options for a log axis. Options must be enclosed in parentheses.Each option is specified as a name = value pair separated by a blank.

Interaction: This option is ignored if the axis type is not LOG.

Log-Axis-Option Description

BASE Specifies the base of the logarithmic scale forthe axis values.

MINORTICKS Specifies whether minor ticks are displayed.

TICKINTERVALSTYLE Specifies how to scale and format the values formajor tick marks.

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

BASE=10 | 2 | Especifies the base of the logarithmic scale for the axis values.

Default: 10

MINORTICKS=booleanspecifies whether minor ticks are displayed:

Default: FALSE

482 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 493: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: Minor ticks can be displayed only when BASE=10 andTICKINTERVALSTYLE= is LOGEXPAND or LOGEXPONENT.

If minor ticks are displayed, the number of minor tick marks is automaticallydetermined.

TICKINTERVALSTYLE=AUTO | LOGEXPAND | LOGEXPONENT | LINEARspecifies how to scale and format the values for major tick marks.

Default: AUTO

Restriction: For LOGEXPAND and LOGEXPONENT, formats on data columnscontributing to the axis are ignored. For LINEAR, ticks values are automaticallyformatted when the column format is not assigned or one of w.d, Ew., or BESTw. Otherformats (SAS defined or user-defined) are used if specified.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

If you use TICKINTERVALSTYLE=LOGEXPONENT, you might want to includeinformation in the axis label about which base is used.

AUTOA LOGEXPAND, LOGEXPONENT, or LINEAR representation is chosenautomatically based on the range of the data. When the data range is small (withinan order of magnitude), a LINEAR representation is typically used. Data rangesthat encompass several orders of magnitude typically use the LOGEXPAND orLOGEXPONENT representation.

LOGEXPANDMajor ticks are placed at uniform intervals at integer powers of the base. The tickvalues are expanded as follows:

Base=10

Base=2

Base=E

LOGEXPONENTMajor ticks are placed at uniform intervals at integer powers of the base. The tickvalues are only the integer exponents for all bases.

LINEARMajor tick marks are placed at non-uniform intervals that cover the range of thedata.

Restriction: For LOGEXPONENT, formats on data columns contributing to the axisare ignored. For LOGEXPAND, formats on data columns contributing to the axis areignored, although any "named format" on the column is retained. For LINEAR, ticksvalues are automatically formatted when the column format is not assigned or one ofw.d, Ew. or BESTw. Other formats (SAS defined or user-defined) are used if specified.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Example Program and Statement Details 483

Page 494: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Interaction: When BASE=10 and LOGEXPAND or LOGEXPONENT is used, anintermediate tick is added whenever the axis data range is less than or equal to 1.5powers of 10.

If you use TICKINTERVALSTYLE=LOGEXPONENT, you might want to includeinformation in the axis label about which base is used.

VIEWMAX= numberspecifies the maximum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The maximum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The minimum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

Options for Time Axes OnlyTIMEOPTS=( time-axis-options )

specifies one or more options for a time axis.

Variables associated with a time axis must be in SAS time, SAS date, or SAS datetimeunits and have an associated SAS time, date, or datetime format.

Options must be enclosed in parentheses. Each option is specified as a name = valuepair separated by a blank.

Interaction: This option is ignored if the axis type is not TIME.

Time-Axis-Option Description

INTERVAL Specifies that evenly spaced integer values areused for tick marks.

MINORTICKS Specifies whether minor ticks are displayed.

SPLITTICKVALUE Specifies whether to split the tick values on anX or X2 axis, if possible. This option is notavailable on a Y or Y2 axis.

TICKVALUEFITPOLICY Specifies a policy for avoiding tick valuecollision on an X or X2 axis. This option is notavailable on a Y or Y2 axis.

TICKVALUEFORMAT Specifies how to format the values for majortick marks.

TICKVALUELIST Specifies the order of the tick values for a timeaxis as list.

484 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 495: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Time-Axis-Option Description

VIEWMAX Specifies the maximum data value to include inthe display.

VIEWMIN Specifies the minimum data value to include inthe display.

INTERVAL=intervalspecifies the time interval between major ticks. Valid interval keywords are AUTO,SECOND, MINUTE, HOUR, DAY, TENDAY, WEEK, SEMIMONTH, MONTH,QUARTER, SEMIYEAR, YEAR.

The data column(s) mapped to a time axis must be in the same duration units: TIME,DATE, or DATETIME. The selection of an interval must be consistent with theduration unit. For example, if the data are in time units, you can select only AUTO,SECOND, MINUTE, HOUR.

Default: AUTO. An appropriate interval is chosen based on the data and the columndate/datetime/time format.

Interaction: This option is ignored if the TICKVALUELIST= option is used.

INTERVAL Unit Tick intervalDefault tick valueformat

AUTO DATE, TIME, orDATETIME

automaticallychosen

automaticallychosen

SECOND TIME orDATETIME

second TIME8.

MINUTE TIME orDATETIME

minute TIME8.

HOUR TIME orDATETIME

hour TIME8.

DAY DATE orDATETIME

day DATE9.

TENDAY DATE orDATETIME

10 days DATE9.

WEEK DATE orDATETIME

7 days DATE9.

SEMIMONTH DATE orDATETIME

1st and 16th of eachmonth

DATE9.

MONTH DATE orDATETIME

month MONYY7.

QUARTER DATE orDATETIME

3 months YYQC6.

Example Program and Statement Details 485

Page 496: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

INTERVAL Unit Tick intervalDefault tick valueformat

SEMIYEAR DATE orDATETIME

6 months MONYY7.

YEAR DATE orDATETIME

year YEAR4.

MINORTICKS=Booleanspecifies whether minor ticks are displayed.

Default: FALSE

Interaction: The number of minor ticks is dependent on the value of the INTERVAL=option.

Interaction: This option is ignored if the TICKVALUELIST= option is used or if thetick marks are not enabled by the DISPLAY= or DISPLAYSECONDARY= option.

SPLITTICKVALUE=Booleanspecifies whether to split the tick values on an X or X2 axis, if possible. This option isnot available for a Y or Y2 axis. For example, with INTERVAL= MONTH, this is howtick values are split:

Default: TRUE

TRUEaxis tick values are split into two lines allowing more tick values to appear

FALSEtypically, fewer tick values fit, causing thinning, rotation, or staggering of thevalues. See the TICKVALUEFITPOLICY= option.

Interaction: This option is ignored if the TICKVALUELIST= orTICKVALUEFORMAT= option is used.

TICKVALUEFITPOLICY=THIN | ROTATE | ROTATETHIN | STAGGER |STAGGERROTATE | STAGGERTHIN

specifies a policy for avoiding tick value collision on an X or X2 axis. This option isnot available for a Y or Y2 axis.

Default: THIN

The collision-avoidance policy that is most effective depends on the number of tickvalues, their length, and the length of the axis. For an X or X2 axis, the policy can beone of the following:

THIN Some tick values are removed.

ROTATE Tick values are rotated 45 degrees.

ROTATETHIN Attempt ROTATE policy and then THINpolicy.

STAGGER Tick values alternate between two rows.

486 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 497: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

STAGGERROTATE Attempt STAGGER policy and thenROTATE policy.

STAGGERTHIN Attempt STAGGER policy and then THINpolicy.

Interaction: When SPLITTICKVALUE= TRUE, this option is ignored and only theTHIN policy is used.

TICKVALUEFORMAT=format | DATAspecifies how to format the values for major tick marks.

Default: The default format used by the INTERVAL= option. The default does notapply if TICKVALUELIST= is specified.

formatA SAS date, time, or datetime format to control how the major tick values aredisplayed. This format must be in the same duration units as the data column(s)mapped to a time axis: TIME, DATE, or DATETIME and should be appropriatefor the value of the INTERVAL= option. For example, if INTERVAL=MONTHand there are two years of data displayed on the axis, choosingTICKVALUEFORMAT=YEAR. would result in several ticks having the sameyear value.

DATASpecifies that the SAS date, time, or datetime format associated with the datacolumn assigned to the axis be used to control how the major tick values aredisplayed.

Restriction: GTL currently honors most but not every SAS format. For details, see“SAS Formats Not Supported” on page 569.

Interaction: If this option is specified, the SPLITTICKVALUE= option is ignored.

TICKVALUELIST=( time-constant-list | date-constant-list | datetime-constant-list |numeric-list )

specifies the tick values for a time axis as list.

Default: An internal algorithm determines the tick values.

Requirement: The list must be enclosed in parentheses and each item separated by ablank. The items in the list must be in the same duration units as the data mapped tothe axis: TIME, DATE, or DATETIME. The values can be expressed as SAS TIME,DATE, or DATETIME constants (for example, "13:23"T, "11MAY06"D, or"11MAY06:13:23"DT) or their numeric equivalents.

Restriction: This option does not extend the data range of the axis. If the values fallwithin the default data range or that specified by the VIEWMIN= or VIEWMAX=options, they are used.

The values in the list are formatted according to the setting for theTICKVALUEFORMAT= option. If TICKVALUEFORMAT= is not used, the valuesare formatted according to the column format (the default TICKVALUEFORMATvalue is not applied to these values).

See also: TICKVALUESEQUENCE= option as an alternate to customizing tick marks.

VIEWMAX= numberspecifies the maximum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The maximum value in the data for the specified axis.

Example Program and Statement Details 487

Page 498: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

VIEWMIN= numberspecifies the minimum data value to include in the display. For more information, see“Adjusting the Axis View” on page 402.

Default: The minimum value in the data for the specified axis.

Setting a VIEWMAX= or VIEWMIN= value does not alter the original data or anycalculations on it.

488 Chapter 46 • Axis Options for LAYOUT DATALATTICE/DATAPANEL

Page 499: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 6

Legend Statements

Chapter 47CONTINUOUSLEGEND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491

Chapter 48DISCRETELEGEND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499

489

Page 500: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

490

Page 501: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 47

CONTINUOUSLEGENDStatement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492Required Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494

Description and Syntax

Creates a legend with a color ramp corresponding to a range of values.

CONTINUOUSLEGEND “graph-name” </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 492:

491

Page 502: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph continuouslegend; begingraph; entrytitle "Height and Weight Distribution"; layout overlay; scatterplot x=height y=weight / markercolorgradient=density markerattrs=(symbol=squarefilled size=6px) name="scatter"; continuouslegend "scatter" / orient=vertical location=outside valign=center halign=right valuecounthint=10 title="Density"; endlayout; endgraph; end;run;proc sgrender data=sashelp.gridded(where=(count>0)) template=continuouslegend;run;

Statement SummaryA continuous legend consists of a color ramp and a numeric scale indicating color values.

In the following figure, the continuous legend references a contour plot with a fixed numberof levels. The color ramp and legend values automatically reflect these discrete levels. Thelegend options VALUECOUNT= and VALUECOUNTHINT= have no effect.

492 Chapter 47 • CONTINUOUSLEGEND Statement

Page 503: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

In this next figure, the continuous legend references a contour plot with a continuousgradient. The number of legend values displayed is automatically determined by the legend,or decided by the contributing plot, such as the CONTOURPLOTPARM withCONTOURTYPE=FILL. For plots with a continuous gradient, you can use the legendoptions VALUECOUNT= or VALUECOUNTHINT= to control how many legend valuesappear (these options are ignored if there is no gradient).

Within an overlay-type layout, when a continuous legend is placed inside the plot area withLOCATION=INSIDE,

• It is always placed on top of plot lines and markers.

• By default, its background is fully transparent ( OPAQUE=FALSE), meaning thatunderlying lines, markers, and data labels show through the legend.

• Its position can be controlled with the AUTOALIGN= option, or with the HALIGN=and VALIGN= options.

Within an overlay-type layout, when a continuous legend is placed outside the plot areawith LOCATION=OUTSIDE,

Example Program and Statement Details 493

Page 504: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

• By default, its background is fully opaque (OPAQUE=TRUE).

• Its position can be controlled with the HALIGN= and VALIGN= options.

Required Argument"graph-name"

specifies the plot to be represented by the legend. The plot is identified by the namethat is assigned to it on the plot statement’s NAME= option.

Requirement: graph-name must be enclosed in quotation marks.

Note: Unlike the DISCRETELEGEND statement, only a single graph-name can bespecified.

Options

Statement Option Description

AUTOALIGN Specifies whether the legend is automaticallyaligned within its parent layout when nestedwithin an overlay-type layout.

BACKGROUNDCOLOR Specifies the color of the legend background.

BORDER Specifies whether a border is displayed aroundthe legend.

BORDERATTRS Specifies the properties of the border linearound the legend.

HALIGN specifies the horizontal alignment of the legendwithin its parent layout when nested within anoverlay-type layout.

LOCATION Specifies whether the legend appears inside oroutside the plot area.

OPAQUE Specifies whether the legend background isopaque.

ORIENT Specifies the orientation of the legend.

PAD Specifies the amount of extra space that isadded inside the legend perimeter.

TITLE Specifies the title of the legend.

TITLEATTRS Specifies the color and font attributes of thelegend title.

VALIGN Specifies the vertical alignment of the legendwithin its parent layout when nested within anoverlay-type layout.

494 Chapter 47 • CONTINUOUSLEGEND Statement

Page 505: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

VALUEATTRS Specifies the color and font attributes of thelegend values.

VALUECOUNT Specifies the number of values that thecontinuous legend must use to label the datarange. Available only for plots that display agradient.

VALUECOUNTHINT Recommends a number of values for thecontinuous legend to use to label the data range.Available only for plots that display a gradient.

AUTOALIGN=NONE | AUTO | (location-list)specifies whether the legend is automatically aligned within its parent layout whennested within an overlay-type layout. For more information about how child positionsare determined in an overlay-type layout, see the LAYOUT OVERLAY’s “ExampleProgram and Statement Details” on page 89.

Default: NONE

NONEDo not automatically align the legend within its parent layout. The legend’s positionis set by the HALIGN= and VALIGN= options.

AUTOAvailable only if the parent layout contains a scatter plot; ignored otherwise. Withinthe parent layout, attempt to center the legend in the area that is farthest from anysurrounding data point markers.

(location-list)Within the parent layout, restrict the legend’s possible locations to those locationsin the specified location-list, and use the location-list position that least collideswith the parent layout’s other graphics features. The location-list is blank-separatedand can contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT,CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.

Interaction: This option has no effect unless LOCATION=INSIDE.

Interaction: If LOCATION=INSIDE, this option overrides HALIGN= andVALIGN=.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the legend background.

Default: The GraphLegendBackground:Color style reference.

style-referenceA reference of the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is displayed around the legend.

Default: FALSE

Example Program and Statement Details 495

Page 506: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the legend. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

HALIGN= RIGHT | CENTER | LEFTspecifies the horizontal alignment of the legend within its parent layout when nestedwithin an overlay-type layout. For more information about how child positions aredetermined in an overlay-type layout, see the LAYOUT OVERLAY’s “ExampleProgram and Statement Details” on page 89.

Default: RIGHT if LOCATION=OUTSIDE CENTER if LOCATION=INSIDE

Restriction: If LOCATION=OUTSIDE, the HALIGN= and VALIGN= optionscannot both be set to CENTER.

Restriction: This option is available only when this statement is nested within anoverlay-type layout. It is ignored if the parent layout is not an overlay-type layout.

Interaction: If LOCATION=INSIDE and the AUTOALIGN= option is enabled, thisoption is ignored.

LOCATION=OUTSIDE | INSIDEspecifies whether the legend appears inside or outside the plot area.

Default: OUTSIDE

Restriction: This option has effect only when the CONTINUOUSLEGEND statementappears within a 2-D overlay-type layout and there is at least one stand-alone plotstatement with XY axes that is referenced by the legend. For more information abouthow child positions are determined in an overlay-type layout, see the LAYOUTOVERLAY’s “Example Program and Statement Details” on page 89.

Interaction: The actual position is determined by the settings for the LOCATION=,AUTOALIGN=, HALIGN= , and VALIGN= options.

Interaction: Within an overlay-type layout, if the ORIENT= option is not set, theorientation changes depending on the actual position. If LOCATION=OUTSIDE andthe legend is right or left of the plot, the orientation is vertical. IfLOCATION=OUTSIDE and the legend is above or below the plot, the orientation ishorizontal.

OPAQUE=booleanspecifies whether the legend background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

ORIENT=VERTICAL | HORIZONTALspecifies the orientation of the legend.

Default: VERTICAL

PAD=dimension | (pad-options)specifies the amount of extra space that is reserved inside the legend perimeter.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

496 Chapter 47 • CONTINUOUSLEGEND Statement

Page 507: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the legend perimeter.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

TITLE= "string"specifies the title of the legend.

Default: no default

Requirement: string must be enclosed in quotation marks.

TITLEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the legend title. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphLabelText style element.

Interaction: For this option to have any effect, the TITLE= option must also bespecified.

VALIGN=CENTER | TOP | BOTTOMspecifies the vertical alignment of the legend within its parent layout when nested withinan overlay-type layout. For more information about how child positions are determinedin an overlay-type layout, see the LAYOUT OVERLAY’s “Example Program andStatement Details” on page 89.

Default: CENTER

Restriction: If LOCATION=OUTSIDE, the VALIGN= and HALIGN= optionscannot both be set to CENTER.

Restriction: This option is available only when this statement is nested within anoverlay-type layout. It is ignored if the parent layout is not an overlay-type layout.

Interaction: If LOCATION=INSIDE and the AUTOALIGN= option is enabled, thisoption is ignored.

VALUEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the legend values. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

Example Program and Statement Details 497

Page 508: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

VALUECOUNT=positive-integerspecifies the number of values that the continuous legend must use to label the datarange.

Default: The VALUECOUNTHINT= setting is used.

Restriction: The associated plot must be displayed with smooth gradient for this optionto have any effect. For example, in a contour plot, CONTOURTYPE must be set toGRADIENT or LINEGRADIENT.

The legend uses even intervals to label the range.

VALUECOUNTHINT=positive-integerrecommends a number of values for the continuous legend to use to label the data range.

Default: 6

Restriction: The associated plot must be displayed with smooth gradient for this optionto have any effect. For example, in a contour plot, CONTOURTYPE must be set toGRADIENT or LINEGRADIENT.

The legend uses even intervals to label the range.

498 Chapter 47 • CONTINUOUSLEGEND Statement

Page 509: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 48

DISCRETELEGEND Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501

Description and Syntax

Creates a legend with entries that refer to plots, or group values, or both.

DISCRETELEGEND "graph-name" <... "graph-name-n"> </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 500:

499

Page 510: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph discretelegend; begingraph; entrytitle "Prediction Ellipses"; layout overlayequated / equatetype=equate; scatterplot x=petallength y=petalwidth / group=species name="s"; ellipse x=petallength y=petalwidth / type=predicted alpha=.2 name="p80" legendlabel="80%" outlineattrs=graphconfidence; ellipse x=petallength y=petalwidth / type=predicted alpha=.05 name="p95" legendlabel="95%" outlineattrs=graphconfidence2; discretelegend "s" / title="Species:"; discretelegend "p80" "p95" / across=1 autoalign=(topleft) location=inside; endlayout; entryfootnote halign=left "Fisher's Iris Data"; endgraph; end;run;

proc sgrender data=sashelp.iris template=discretelegend;run;

500 Chapter 48 • DISCRETELEGEND Statement

Page 511: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement SummaryA discrete legend consists of one or more units called legend entries. Each legend entryconsists of a legend symbol and a legend value. The legend symbol is typically a marker,line, or fill that represents a specific area in the plot. The legend value is descriptive textderived from group values or assigned with the plot’s LEGENDLABEL= option.

Within an overlay-type layout, when a discrete legend is placed inside the plot area withLOCATION=INSIDE,

• It is always placed on top of plot lines and markers.

• By default, its background is fully transparent ( OPAQUE=FALSE), meaning thatunderlying lines, markers, and data labels show through the legend.

• Its position can be controlled with the AUTOALIGN= option, or with the HALIGN=and VALIGN= options.

Within an overlay-type layout, when a discrete legend is placed outside the plot area withLOCATION=OUTSIDE,

• By default, its background is fully opaque (OPAQUE=TRUE).

• Its position can be controlled with the HALIGN= and VALIGN= options.

When a discrete legend is placed within nested layouts, it might be necessary to use theACROSS= and ORDER=ROWMAJOR options or the DOWN= andORDER=COLUMNMAJOR options to obtain the desired legend organization. A legendmight be dropped if the total legend area in the graph exceeds the percentage set by theMAXLEGENDAREA= option on an ODS GRAPHICS ON statement that is in effect forthe output destination.

Required Arguments“graph-name”

references one or more unique names that are specified by the NAME= option of a plotstatement. These names control which plots contribute to the legend, and the order inwhich the legend entries occur. If a contributing plot uses a GROUP= option, then thereis a legend entry for each group value.

• Each graph-name must be enclosed in quotation marks.

• Each plot that is referenced must be able to be identified by the legend entries. Forexample, a filled CONTOURPLOTPARM plot cannot be specified in theDISCRETELEGEND statement because it requires a continuous legend.

Options

Statement Option Description

ACROSS Specifies the number of legend entries that areplaced horizontally before the next row begins.

AUTOALIGN Specifies whether the legend is automaticallyaligned within its parent layout when nestedwithin an overlay-type layout.

Example Program and Statement Details 501

Page 512: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the legend background.

BORDER Specifies whether a border is displayed aroundthe legend.

BORDERATTRS Specifies the properties of the border linearound the legend.

DISPLAYCLIPPED Specifies whether the legend is displayed whenany portion of the legend is not entirelyrendered.

DOWN Specifies the number of legend entries that areplaced vertically before the next column begins.

HALIGN on page 504 Specifies the horizontal alignment of the legendwithin its parent layout when nested within anoverlay-type layout.

LOCATION on page 504 Specifies whether the legend appears inside oroutside the plot area when the legend isspecified within an overlay-type layout.

OPAQUE Specifies whether the legend background isopaque.

ORDER Specifies the order of the legend entries.

PAD Specifies the amount of extra space that isadded inside the legend perimeter.

TITLE Specifies the title of the legend.

TITLEATTRS Specifies the color and font attributes of thelegend title.

TITLEBORDER Specifies a border around the legend title thatseparates the title from the legend body.

VALIGN Specifies the vertical alignment of the legendwithin its parent layout when nested within anoverlay-type layout.

VALUEATTRS Specifies the color and font attributes of thelegend values.

ACROSS=positive-integerspecifies the number of legend entries that are placed horizontally before the next rowbegins.

Default: The entries are placed to best fit the available area. This “best fit” approachonly works when the legend is nested in the template’s outermost layout.

Restriction: This option is ignored if ORDER=COLUMNMAJOR

502 Chapter 48 • DISCRETELEGEND Statement

Page 513: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

A legend entry typically consists of two parts, such as a marker symbol and anassociated value.

AUTOALIGN=NONE | AUTO | (location-list)specifies whether the legend is automatically aligned within its parent layout whennested within an overlay-type layout. For more information about how child positionsare determined in an overlay-type layout, see the LAYOUT OVERLAY’s “ExampleProgram and Statement Details” on page 89.

Default: NONE

NONEDo not automatically align the legend within its parent layout. The legend’s positionis set by the HALIGN= and VALIGN= options.

AUTOAvailable only if the parent layout contains a scatter plot; ignored otherwise. Withinthe parent layout, attempt to center the legend in the area that is farthest from anysurrounding data point markers.

(location-list)Within the parent layout, restrict the legend’s possible locations to those locationsin the specified location-list, and use the location-list position that least collideswith the parent layout’s other graphics features. The location-list is blank-separatedand can contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT,CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.

Interaction: This option has no effect unless LOCATION=INSIDE.

Interaction: If LOCATION=INSIDE, this option overrides HALIGN= andVALIGN=.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the legend background.

Default: The GraphLegendBackground:Color style reference.

style-referenceA reference of the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is displayed around the legend.

Default: TRUE

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the legend. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

DISPLAYCLIPPED=booleanspecifies whether the legend is displayed when any portion of the legend is not entirelyrendered.

Default: FALSE

Example Program and Statement Details 503

Page 514: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

When the graph size is reduced, parts of the legend (title, legend symbol, or legendvalue) might be clipped (truncated). When clipping occurs and DISPLAYCLIPPED isFALSE, the entire legend is removed from the graph and the space for it is reclaimedby the remainder of the graph. When DISPLAYCLIPPED is TRUE, the legend alwaysappears, even if some parts of have been clipped.

DOWN=positive-integerspecifies the number of legend entries that are placed vertically before the next columnbegins.

Default: The entries are placed to best fit the available area. This “best fit” approachonly works when the legend is nested in the template’s outermost layout.

Restriction: This option is ignored if ORDER=ROWMAJOR

A legend entry typically consists of two parts, such as a marker symbol and anassociated value.

HALIGN=CENTER | LEFT | RIGHTspecifies the horizontal alignment of the legend within its parent layout when nestedwithin an overlay-type layout. For more information about how child positions aredetermined in an overlay-type layout, see the LAYOUT OVERLAY’s “ExampleProgram and Statement Details” on page 89.

Default: CENTER

Restriction: If LOCATION=OUTSIDE, the HALIGN= and VALIGN= options cannotboth be set to CENTER.

Restriction: This option is available only when this statement is nested within anoverlay-type layout. It is ignored if the parent layout is not an overlay-type layout.

Interaction: If LOCATION=INSIDE and the AUTOALIGN= option is enabled, thisoption is ignored.

LOCATION=OUTSIDE | INSIDEspecifies whether the legend appears inside or outside the plot area.

Default: OUTSIDE

Restriction: This option has effect only when the DISCRETELEGEND statementappears within an overlay-type layout and at least one stand-alone plot statement withXY axes is referenced by the legend. For more information about how child positionsare determined in an overlay-type layout, see the LAYOUT OVERLAY’s “ExampleProgram and Statement Details” on page 89.

Interaction: The actual position is determined by the settings for the LOCATION=,AUTOALIGN=, HALIGN=, and VALIGN= options.

OPAQUE=booleanspecifies whether the legend background is opaque (TRUE) or transparent (FALSE).

Default: TRUE when LOCATION=OUTSIDE FALSE when LOCATION=INSIDE

Interaction: When this option is set to FALSE, the background color is not used.

ORDER=ROWMAJOR | COLUMNMAJORspecifies whether legend entries are added as rows or as columns.

Default: ROWMAJOR

Interaction: If ORDER=ROWMAJOR, use the ACROSS= option to limit the numberof entries in a row. If ORDER=COLUMNMAJOR, use the DOWN= option to limitthe number of entries in a column.

504 Chapter 48 • DISCRETELEGEND Statement

Page 515: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PAD=dimension | (pad-options)specifies the amount of extra space that is reserved inside the legend perimeter.

Default: The default padding for all sides is 0. Values without units are in pixels (px).A unit must be provided if other than pixels.

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the legend perimeter.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

TITLE= "string"specifies the title of the legend.

Default: no default

Requirement: string must be enclosed in quotation marks.

TITLEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the legend title. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphLabelText style element.

Interaction: For this option to have any effect, the TITLE= option must also bespecified.

TITLEBORDER=booleanspecifies a border around the legend title that separates it from the legend body.

Default: FALSE

Interaction: For this option to have any effect, the TITLE= option must also bespecified.

The line attributes of the title border are set by the BORDERATTRS= options.

VALIGN=CENTER | TOP | BOTTOMspecifies the vertical alignment of the legend within its parent layout when nested withinan overlay-type layout. For more information about how child positions are determinedin an overlay-type layout, see the LAYOUT OVERLAY’s “Example Program andStatement Details” on page 89.

Default: CENTER

Restriction: If LOCATION=OUTSIDE, the VALIGN= and HALIGN= options cannotboth be set to CENTER.

Example Program and Statement Details 505

Page 516: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Restriction: This option is available only when this statement is nested within anoverlay-type layout. It is ignored if the parent layout is not an overlay-type layout.

Interaction: If LOCATION=INSIDE and the AUTOALIGN= option is enabled, thisoption is ignored.

VALUEATTRS=style-element | style-element (text-options) | (text-options)specifies the color and font attributes of the legend values. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

506 Chapter 48 • DISCRETELEGEND Statement

Page 517: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 7

Text Statements

Chapter 49Managing Text Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509

Chapter 50ENTRY Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

Chapter 51ENTRYFOOTNOTE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525

Chapter 52ENTRYTITLE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

507

Page 518: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

508

Page 519: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 49

Managing Text Items

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509

Using Prefix Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510Available Prefix Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510Managing Horizontal Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510Managing Font Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511

Using Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512Available Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512Subscripting and Superscripting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513Using UNICODE Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513

Reserved Keywords and Unicode Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514Lower Case Greek Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514Upper Case Greek Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515

OverviewThe ENTRY, ENTRYTITLE, and ENTRYFOOTNOTE statements all use the same syntaxfor specifying one or more pieces of text called text-items. For example, here is theENTRYTITLE syntax:

ENTRYTITLE text-item <…<text-item>> </option(s)>;

Each text-item can be specified using the following syntax:

<prefix-option…<prefix-option>> "string" | dynamic | character-expression | {text-command}

The simplest specification for each statement is to specify a string in quotes. For example,you might specify a graph title as follows:

entrytitle "Height and Weight by Sex";

In this example, the string Height and Weight by Sex is formatted as the graph title anddisplayed in the title position. If multiple strings are specified, they are concatenated intoa single line of text. This second specification generates the same title:

entrytitle "Height " "and " "Weight " "by " "Sex";

509

Page 520: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

To provide control over the text, multiple prefix options can precede each text-item, andthe text-item can be a string literal, a dynamic, or a text command. All text-items with thesame HALIGN= setting are concatenated into one string. Up to three strings with differenthorizontal alignment can result for each ENTRY statement. Leading and trailing blanks inthe concatenated string are always used.

• a string must be enclosed in quotation marks.

• a character-expression must be enclosed in an EVAL function.

• a text-command must be enclosed in braces (see “Using Text Commands” on page512).

Using Prefix Options

Available Prefix OptionsThe following prefix options are available on ENTRY, ENTRYTITLE, andENTRYFOOTNOTE statements:

HALIGNSpecifies the horizontal alignment of a text-item.

TEXTATTRSSpecifies font attributes for a text-item.

When used, a prefix option applies not only to immediately following piece of text but alsoto ALL subsequent text strings and text-commands. If the same prefix option appears morethan once, each use overrides the last used prefix of the same name.

Managing Horizontal AlignmentFor the ENTRY, ENTRYTITLE, and ENTRYFOOTNOTE statements, the defaulthorizontal alignment is CENTER.

entry "One" " Two" " Three" " Four" " Five" " Six";

To change the default alignment, you can use the HALIGN= option, which can specifyLEFT, CENTER, or RIGHT alignment. The following specification left-justifies the text:

entry halign=left "One" " Two" " Three" " Four" " Five" " Six";

Text items are positionally concatenated by alignment area. For example, the followingspecification left-justifies the first three strings and right-justifies the last three strings:

510 Chapter 49 • Managing Text Items

Page 521: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

entry halign=left "One" " Two" " Three" halign=right "Four" " Five" " Six";

Even if the HALIGN= specifications are jumbled, the final text is nevertheless positionallyconcatenated by alignment area:

entry halign=right "Five" halign=left "One" halign=right " Six" halign=center "Three" halign=left " Two" halign=center " Four";

When long strings are used or the bounding container is constrained, the alignment areasmight overlap.

Managing Font AttributesFor the ENTRY, ENTRYTITLE, and ENTRYFOOTNOTE statements, the default fontattributes are determined by the active ODS style. To change the default font attributes,you can use the TEXTATTRS= option, which has the following syntax (see “GeneralSyntax for Attribute Options” on page 563 for the syntax on using a style-element and“Text Options” on page 566 for available text-options):

TEXTATTRS=style-element | style-element(text-options) | (text-options)

For example, the following ENTRYTITLE statement uses prefix options to create this titleline:

entrytitle textattrs=(color=black) "Center" textattrs=(color=red) " Text" halign=right textattrs=(color=black size=10pt) "Right " textattrs=(color=red size=10pt) "side" halign=left textattrs=(color=black style=italic size=10pt) "Left" textattrs=(color=red style=italic size=10pt) " side";

• The TEXTATTRS= options are reset each time a new TEXTATTRS= appears—thereis no “carry over” or accumulation of the settings.

• Blanks (spaces) must be provided as needed to achieve the desired concatenation. Ifyou are concatenating dynamics that are stripped of leading and trailing blanks, youmight need to introduce a literal space to separate them, as shown in the followingexample:

entry _DYN1 " " _DYN2;

Alternatively, you can specify font attributes by overriding style element defaults. Thefollowing specification overrides the settings of the GraphTitleText style element, whichsets the default attributes for ENTRYTITLE text:

entrytitlehalign=left

Using Prefix Options 511

Page 522: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

textattrs=GraphTitleText(color=black style=italic) "Left" textattrs=GraphTitleText(color=red style=italic) " side"halign=center textattrs=(color=black) "Center" textattrs=(color=red) " Text"halign=right textattrs=GraphTitleText(color=black weight=bold) "Right " textattrs=GraphTitleText(color=red weight=bold) "side" ;

You can also use dynamics in the text-items. In the following ENTRYTITLE statement,assume that _DEPLABEL and _MODELLABEL are dynamics that are specified on PROCTEMPLATE’s DYNAMIC statement:

entrytitle "Residual by Predicted for " _DEPLABEL halign=left textattrs=GraphTitleText _MODELLABEL / pad=(bottom=5);

• The default style element for ENTRYTITLE is GraphTitleText, so all three text items(one literal and two dynamics) get these font properties as a starting point.

• The text "Residual by Predicted for " _DEPLABEL is center-aligned by default.

• The prefix options HALIGN= and TEXTATTRS= override the center alignment andfont properties for the text _MODELLABEL.

Notice that this could have been coded as follows:

entrytitle halign=left textattrs=GraphTitleText _MODELLABEL halign=center textattrs=() "Residual by Predicted for " _DEPLABEL;

In this example, the second HALIGN= and TEXTATTRS=() were necessary to resetalignment and font properties to their defaults.

Note that the string length of the resolved dynamic _MODELLABEL does not affect theplacement of the center-aligned text.

Using Text Commands

Available Text CommandsText commands on ENTRY, ENTRYTITLE, and ENTRYFOOTNOTE statements arespecial in-line instructions that either modify the appearance of the text or script specialcharacters. The following text commands are available:

{SUB}Specifies that the string or dynamic appears as a subscript.

{SUP}Specifies that the string or dynamic appears as a superscript.

{UNICODE}Specifies a glyph (graphical character) to be displayed using its Unicode specificationor keyword equivalent.

The general form of a text command is

512 Chapter 49 • Managing Text Items

Page 523: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

{command argument(s)}

The opening and closing braces are required to denote the scope of the command.

Subscripting and Superscripting TextThe {SUB} and {SUP} text commands are used to subscript and superscript text. Each ofthese text commands accepts a string or a dynamic for its argument(s).

In the following example, if _RSQUARE is an existing dynamic that resolves to thevalue .7434, then the following ENTRY specification superscripts the string value "2" togenerate this text:

entry textattrs=(weight=bold) "R" {sup "2"} textattrs=() "=" _RSQUARE;

Notice that textattrs=() cancels all style overrides and reverts to the default text properties.

Using UNICODE TextThe {UNICODE} text command places special characters into the text and accepts any ofthe following for its argument(s):

• a hexadecimal Unicode Code Point for a character (for example, "03B1"x)

• a reserved keyword for a commonly used code point (for example, beta)

• a dynamic that resolves to a hexadecimal value or keyword.

See the tables in “Reserved Keywords and Unicode Values” on page 514 for a list of thereserved keywords and Unicode values (the tables are not complete, but give a good ideaabout what is possible).

Multiple arguments can be used within the scope of a single UNICODE text command.For example, the following two specifications are equivalent:

{unicode "03b1"x beta}{unicode "03b1"x} {unicode beta}

The default formatting for the UNICODE text is derived from the GraphUnicodeText styleelement.

In the following example, if _ALPHAVAL is an existing dynamic that resolves to the value0.05, then the following ENTRY specification generates this text:

entry {unicode alpha} " = " _ALPHAVAL;

By combining the TEXTATTRS= prefix option with the {SUB} and {UNICODE} textcommands, you can generate the following text:

Using Text Commands 513

Page 524: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Entry textattrs=(style=italic) "E(Y)" textattrs=() " = " {unicode beta} {sub "0"} " + " {unicode beta} {sub "1"} "x" {sub "1"} " + " {unicode beta} {sub "2"} "x" {sub "2"};

Reserved Keywords and Unicode Values

OverviewThe tables that follow show some of the reserved keywords and Unicode values that canbe used with the UNICODE text command.

Keywords and Unicode values are not case-sensitive: "03B1"x is the same code point as"03b1"x.

The word blank is the keyword for a blank space.

Lower Case Greek Letters

514 Chapter 49 • Managing Text Items

Page 525: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Upper Case Greek Letters

Reserved Keywords and Unicode Values 515

Page 526: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

516 Chapter 49 • Managing Text Items

Page 527: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 50

ENTRY Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519Options and Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520

Description and Syntax

Displays a line of text in the plot area.

ENTRY text-item <…<text-item>> </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 518:

517

Page 528: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph entry; begingraph; layout overlay;

entry halign=right "First entry statement" / valign=top;

histogram weight;

entry halign=right "Second entry statement";

entry halign=right "Third entry statement" / valign=bottom pad=(bottom=40px);

endlayout; endgraph; end;run;

proc sgrender data=sashelp.cars template=entry;run;

Statement SummaryAn ENTRY statement creates one line of text in the plot area. The statement must bespecified within a LAYOUT, HEADER, SIDEBAR, or CELL statement block. It cannotbe specified outside of one of these blocks, where global statements like ENTRYTITLEand ENTRYFOOTNOTE are used.

518 Chapter 50 • ENTRY Statement

Page 529: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

The text line specified on an ENTRY statement can be made of several pieces of the textcalled text-items. Statement options that are used establish properties for the entire line oftext (that is, all text-items). These properties can be overridden with prefix-options that arespecific to one or more text-items. See “Required Arguments” on page 519 for moreinformation.

You can specify an ENTRY statement inside or outside of a nested statement block:

• When you specify an ENTRY statement inside of a nested LAYOUT, HEADER,SIDEBAR, or CELL statement block, then, by default, the text is placed inside thebounding area of the results that the nested statement block creates.

• When you specify an ENTRY statement outside of a nested LAYOUT, HEADER,SIDEBAR, or CELL statement block, then the text is placed outside of the boundingarea of the results that the nested statement block creates.

Required Argumentstext-item <…<text-item>>

specifies one or more pieces of text for the entry. Each text-item has the following form:

<prefix-option …<prefix-option>>"string" | dynamic | character-expression | {text-command}

Each piece of text can have multiple prefix settings that precede the piece of text. Apiece of text is either a string literal, a dynamic, or a text command. All text-items withthe same HALIGN= setting are concatenated into one string. Up to three strings canresult for each ENTRY statement. Leading and trailing blanks in the concatenated stringare always used.

When used, a prefix option applies not only to immediately following piece of text butalso to ALL subsequent text strings and text-commands. If the same prefix optionappears more than once, it has the effect of overriding the last used prefix of the samename.

Requirement:

• string must be enclosed in quotation marks.

• character-expression must be enclosed in an EVAL function.

• text-command must be enclosed in braces.

See LINK TO GENERIC ENTRY STRINGS DOC for more information and severalexamples.

Example Program and Statement Details 519

Page 530: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Options and Text Commands

prefix-option Description

HALIGN Specifies the horizontal alignment of a text-item.

TEXTATTRS Specifies font attributes for a text-item.

text-command Description

{SUB} Specifies that the string or dynamic appears asa subscript.

{SUP} Specifies that the string or dynamic appears asa superscript.

{UNICODE} Specifies a glyph (graphical character) to bedisplayed using its Unicode specification orkeyword equivalent.

Statement Option Description

AUTOALIGN Specifies whether the entry is automaticallyaligned within its parent when nested within anoverlay-type layout.

BACKGROUNDCOLOR Specifies the color of the entry background.

BORDER Specifies whether a border is displayed aroundthe entry.

BORDERATTRS Specifies the properties of the border line.

OPAQUE Specifies whether the entry background isopaque.

PAD Specifies the amount of extra space that isreserved inside the entry border.

ROTATE Specifies the angle of text rotation.

TEXTATTRS Specifies the font attributes of the text.

VALIGN Specifies the vertical alignment of the entry.

AUTOALIGN=NONE | AUTO | (location-list)specifies whether the entry is automatically aligned within its parent when nested withinan overlay-type layout. For more information about how child positions are determinedin an overlay-type layout, see the LAYOUT OVERLAY’s “Example Program andStatement Details” on page 89.

520 Chapter 50 • ENTRY Statement

Page 531: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: NONE

NONEDo not automatically align the entry within the area. Alignment is set withHALIGN= and VALIGN= options.

AUTOAvailable only if the parent layout contains a scatter plot; ignored otherwise. Withinthe parent layout, attempt to center the entry in the area that is farthest from anysurrounding data point markers.

(location-list)Within the available area, restrict the entry’s possible locations to those locationsin the specified location-list, and use the location-list position that least collideswith the other graphics features in the area. The location-list is blank-separated andcan contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER,RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.

Example: (TOPRIGHT TOPLEFT)

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the entry background.

Default: The GraphBackground:Color style reference.

style-referenceA reference of the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is displayed around the entry.

Default: FALSE

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the text. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

HALIGN=CENTER | LEFT | RIGHTprefix-option that specifies the horizontal alignment of a text-item.

Default: CENTER

Each text-item has a horizontal alignment, and text-items with the same alignment arealways grouped together.

OPAQUE=booleanspecifies whether the entry background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

PAD=dimension | (pad-options)specifies the amount of extra space that is reserved inside the entry border.

Default: (LEFT=3 RIGHT=3 TOP=0 BOTTOM=0)

Example Program and Statement Details 521

Page 532: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the entry border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

ROTATE=0 | 90 | 180 | 270specifies the angle of text rotation measured in degrees. The angle is measured from ahorizontal line passing through the middle of the bounding box of the text, counter-clockwise starting at the center of the bounding box.

Default: 0. No rotation is performed.

Restriction: Only angles of 0, 90, 180, or 270 degrees are allowed.

Interaction: The bounding box is the determined by the size of the text in the currentfont plus any horizontal and vertical padding. See TEXTATTRS= and PAD=.

{ SUB "string" | dynamic }text-command that specifies that the string or dynamic is to appear as subscript text.

Default: no default

Example: entry "y = " b{sub "0"} " + b" {sub "1"} "x";

{ SUP "string" | dynamic }text-command that specifies that the string or dynamic is to appear as superscript text.

Default: no default

Example: entry "R" {sup "2"} " = " {format (6.4) RSQUARED} ;

TEXTATTRS=style-element | style-element (text-options) | (text-options)as a statement option, specifies the text properties of the entire entry text. As a prefix-option, specifies the text properties of individual text-items. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphValueText style element.

This option can be used as both a prefix option and a statement option. When used asa prefix option, it overrides the statement option.

When used as a prefix option, TEXTATTRS=( ) cancels the last used TEXTATTRS=prefix option. It resets all text options to those set by 1) the TEXTATTRS= statementoption or 2) the default style element for the statement (GraphValueText) if noTEXTATTRS= statement option is used.

522 Chapter 50 • ENTRY Statement

Page 533: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

{ UNICODE "hex-string"x | keyword | dynamic }text-command that specifies a glyph (character) to be displayed using its Unicodespecification or keyword equivalent.

Default: no default

"hex-string"xA four-byte hexadecimal constant that represents a UNICODE character in thecurrent font. For a complete listing, see http://unicode.org/charts/charindex.html.

keywordA SAS keyword for a UNICODE character. For a listing of SAS supplied keywords,see LINK TO GENERIC ENTRY STRINGS.

dynamicThe dynamic must resolve to either "hex-string"x or a keyword for a UNICODEcharacter.

Examples:

entry {unicode alpha} "=" CONF;

entry {unicode "03B1"x} "=" CONF;

This text command attempts to access a UNICODE value in the current font. Not allfonts support accessing characters via their UNICODE value. Some fonts only supporta limited set of UNICODE values. If the UNICODE value is not accessible, thecommand might be ignored or an unprintable character might be substituted.

VALIGN=CENTER | TOP | BOTTOMspecifies the vertical alignment of the entry.

Default: CENTER

Example Program and Statement Details 523

Page 534: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

524 Chapter 50 • ENTRY Statement

Page 535: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 51

ENTRYFOOTNOTE Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527Options and Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528

Description and SyntaxDisplays a footnote.

ENTRYFOOTNOTE text-item <…<text-item>> </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 526:

525

Page 536: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph entryfootnote; begingraph;

entryfootnote "First entryfootnote statement" ;

layout overlay; histogram weight; endlayout;

entryfootnote "Second entryfootnote statement" ; entryfootnote "Third entryfootnote statement" ;

endgraph; end;run;

proc sgrender data=sashelp.cars template=entryfootnote;run;

Statement SummaryThe ENTRYFOOTNOTE statement places footnote text below the graphical area. Morethan one ENTRYFOOTNOTE statement can be used. Footnotes appear in the order of theENTRYFOOTNOTE statements within the template.

526 Chapter 51 • ENTRYFOOTNOTE Statement

Page 537: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

When adding an ENTRYFOOTNOTE statement to a template definition, the statementmust be located within the BeginGraph/EndGraph block but outside of the outermost layoutblock.

• All ENTRYFOOTNOTE statements that appear in the template are gathered and placedin the ENTRYFOOTNOTE area.

• The placement of an ENTRYFOOTNOTE statement is relevant only in relation to otherENTRYFOOTNOTE statements.

• As the number of ENTRYFOOTNOTE statements increases the size of the graphicalarea is reduced.

Footnotes always span the entire width of the output. By default, footnotes are “center-aligned,” based on the type of the outermost layout. The meaning of “center-aligned” variesby layout type and the number of columns in the layout:

Layout Type Default horizontal centering of footnotes

GRIDDED

OVERLAY3D

LATTICE (COLUMNS > 1)

DATAPANEL (COLUMNS > 1)

DATALATTICE (COLUMNS > 1)

Centered on width of entire graph

OVERLAY

OVERLAYEQUATED

LATTICE (COLUMNS = 1)

DATAPANEL (COLUMNS = 1)

DATALATTICE (COLUMNS = 1)

Centered on the plot area

Required Argumentstext-item <…<text-item>>

specifies one or more pieces of text for the entry. Each text-item has the following form:

<prefix-option …<prefix-option>>"string" | dynamic | character-expression | {text-command}

Each piece of text can have multiple prefix options that precede the piece of text. Apiece of text is either a string literal, a dynamic, or a text command. All text-items withthe same HALIGN= setting are concatenated into one string. Up to three strings canresult for each ENTRY statement. Leading and trailing blanks in the concatenated stringare always used.

Example Program and Statement Details 527

Page 538: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

When used, a prefix option applies not only to immediately following piece of text butalso to ALL subsequent text strings and text-commands. If the same prefix optionappears more than once, it has the effect of overriding the last used prefix of the samename.

Requirement:

• string must be enclosed in quotation marks.

• character-expression must be enclosed in an EVAL function.

• text-command must be enclosed in braces.

See LINK TO GENERIC ENTRY STRINGS DOC for more information and severalexamples.

Options and Text Commands

prefix-option Description

HALIGN Specifies the horizontal alignment of a text-item.

TEXTATTRS Specifies font attributes for a text-item.

text-command Description

{SUB} Specifies that the string or dynamic appears asa subscript.

{SUP} Specifies that the string or dynamic appears asa superscript.

{UNICODE} Specifies a glyph (graphical character) to bedisplayed using its Unicode specification orkeyword equivalent.

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the footnote background.

BORDER Specifies whether a border is displayed aroundthe footnote.

BORDERATTRS Specifies the properties of the border line.

OPAQUE Specifies whether the footnote background isopaque.

PAD Specifies the amount of extra space that isreserved inside the footnote border.

528 Chapter 51 • ENTRYFOOTNOTE Statement

Page 539: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

SHORTTEXT Specifies an alternate footnote to use if thespecified footnote is too long for the outputwidth.

TEXTATTRS Specifies the text properties of the entirefootnote text.

TEXTFITPOLICY Specifies how to handle a footnote that is toolong to fit in the output width.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the footnote background.

Default: The GraphBackground:Color style reference.

style-referenceA reference of the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is displayed around the footnote.

Default: FALSE

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the footnote. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

HALIGN=CENTER | LEFT | RIGHTprefix-option that specifies the horizontal alignment of a text-item.

Default: CENTER

Each text-item has a horizontal alignment, and text-items with the same alignment arealways concatenated together.

OPAQUE=booleanspecifies whether the footnote background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

PAD=dimension | (pad-options)specifies the amount of extra space that is reserved inside the footnote border.

Default: (LEFT=3 RIGHT=3 TOP=0 BOTTOM=0)

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the footnote border.

Example Program and Statement Details 529

Page 540: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

SHORTTEXT= (text-item <…<text-item>>)specifies an alternate footnote to use if the specified footnote is too long for the outputwidth. If the shortened text is itself too long, it is truncated.

Default: no default

Interaction: This option has no effect unless TEXTFITPOLICY=SHORT.

Interaction: This option is ignored if any text-items include an HALIGN= prefixoption.

Interaction: The horizontal alignment of the shortened text is derived from thehorizontal alignment of the footnote to be shortened.

{ SUB "string" | dynamic }text-command that specifies that the string or dynamic is to appear as subscript text.

Default: no default

Example: entryfootnote "y = " b{sub "0"} " + b" {sub "1"} "x";

{ SUP "string" | dynamic }text-command that specifies that the string or dynamic is to appear as superscript text.

Default: no default

Example: entryfootnote "R" {sup "2"} " = " RSQUARED;

TEXTATTRS=style-element | style-element (text-options) | (text-options)as a statement option, specifies the text properties of the entire entry text. As a prefix-option, specifies the text properties of individual text-items. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “TextOptions” on page 566 for available text-options.

Default: The GraphFootnoteText style element.

This option can be used as both a prefix option and a statement option. When used asa prefix option, it overrides the statement option.

When used as a prefix option, TEXTATTRS=( ) cancels the last used TEXTATTRS=prefix option. It resets all text options to those set by 1) the TEXTATTRS= statementoption or 2) the default style element for the statement (GraphFootnoteText) if noTEXTATTRS= statement option is used.

TEXTFITPOLICY=WRAP | SHORT | TRUNCATEspecifies how to handle a footnote that is too long to fit in the output width.

530 Chapter 51 • ENTRYFOOTNOTE Statement

Page 541: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Default: WRAP

WRAPspecifies that the text wraps to the next line(s).

SHORTspecifies that the text indicated by the SHORTTEXT= option be substituted whenthe footnote does not fit.

TRUNCATEspecifies that the text is truncated to make it fit.

Interaction: If you specify SHORT for this option, you should assign a shortenedversion of the footnote with the SHORTTEXT= option. If the shortened footnote isitself too long, it is truncated.

{ UNICODE "hex-string"x | keyword | dynamic }text-command that specifies a glyph (character) to be displayed using its Unicodespecification or keyword equivalent.

Default: no default

"hex-string"xA four-byte hexadecimal constant that represents a UNICODE character in thecurrent font. For a complete listing, see http://unicode.org/charts/charindex.html.

keywordA SAS keyword for a UNICODE character. For a listing of SAS supplied keywords,see “Reserved Keywords and Unicode Values” on page 514.

dynamicThe dynamic must resolve to either "hex-string"x or a keyword for a UNICODEcharacter.

Examples:

entryfootnote {unicode alpha} "=" CONF;

entryfootnote {unicode "03B1"x} "=" CONF;

This text command attempts to access a UNICODE value in the current font. Not allfonts support accessing characters via their UNICODE value. Some fonts only supporta limited set of UNICODE values. If the UNICODE value is not accessible, thecommand might be ignored or an unprintable character might be substituted.

Example Program and Statement Details 531

Page 542: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

532 Chapter 51 • ENTRYFOOTNOTE Statement

Page 543: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 52

ENTRYTITLE Statement

Description and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

Example Program and Statement Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533Example Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534Statement Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534Required Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535Options and Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536

Description and SyntaxDisplays a title.

ENTRYTITLE text-item <…<text-item>> </option(s)>;

Example Program and Statement Details

Example GraphThe following graph was generated by the “Example Program” on page 534:

533

Page 544: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Example Programproc template; define statgraph entrytitle; begingraph;

entrytitle "First entrytitle statement" ;

layout overlay; histogram weight; endlayout;

entrytitle "Second entrytitle statement" ; entrytitle "Third entrytitle statement" ;

endgraph; end;run;

proc sgrender data=sashelp.cars template=entrytitle;run;

Statement SummaryThe ENTRYTITLE statement places title text above the graphical area. More than oneENTRYTITLE statement can be used. Titles appear in the order of the ENTRYTITLEstatements within the template.

534 Chapter 52 • ENTRYTITLE Statement

Page 545: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

When adding an ENTRYTITLE statement to a template definition, the statement must belocated within the BeginGraph/EndGraph block but outside of the outermost layout block.

• All ENTRYTITLE statements that appear in the template are gathered and placed inthe ENTRYTITLE area.

• The placement of an ENTRYTITLE statement is relevant only in relation to otherENTRYTITLE statements.

• As the number of ENTRYTITLE statements increases the size of the graphical area isreduced.

Titles always span the entire width of the output. By default, titles are “center-aligned,”based on the type of the outermost layout. The meaning of “center-aligned” varies by layouttype and the number of columns in the layout:

Layout Type Default horizontal centering of titles

GRIDDED

OVERLAY3D

LATTICE (COLUMNS > 1)

DATAPANEL (COLUMNS > 1)

DATALATTICE (COLUMNS > 1)

Centered on width of entire graph

OVERLAY

OVERLAYEQUATED

LATTICE (COLUMNS = 1)

DATAPANEL (COLUMNS = 1)

DATALATTICE (COLUMNS = 1)

Centered on the plot area

Required Argumentstext-item <…<text-item>>

specifies one or more pieces of text for the entry. Each text-item has the following form:

<prefix-option …<prefix-option>>"string" | dynamic | character-expression | {text-command}

Each piece of text can have multiple prefix options that precede the piece of text. Apiece of text is either a string literal, a dynamic, or a text command. All text-items withthe same HALIGN= setting are concatenated into one string. Up to three strings canresult for each ENTRY statement. Leading and trailing blanks in the concatenated stringare always used.

When used, a prefix option applies not only to immediately following piece of text butalso to ALL subsequent text strings and text-commands. If the same prefix option

Example Program and Statement Details 535

Page 546: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

appears more than once, it has the effect of overriding the last used prefix of the samename.

Requirement:

• string must be enclosed in quotation marks.

• character-expression must be enclosed in an EVAL function.

• text-command must be enclosed in braces.

See LINK TO GENERIC ENTRY STRINGS DOCfor more information and severalexamples.

Options and Text Commands

prefix-option Description

HALIGN Specifies the horizontal alignment of a text-item.

TEXTATTRS Specifies font attributes for a text-item.

text-command Description

{SUB} Specifies that the string or dynamic appears asa subscript.

{SUP} Specifies that the string or dynamic appears asa superscript.

{UNICODE} Specifies a glyph (graphical character) to bedisplayed using its Unicode specification orkeyword equivalent.

Statement Option Description

BACKGROUNDCOLOR Specifies the color of the title background.

BORDER Specifies whether a border is displayed aroundthe title.

BORDERATTRS Specifies the properties of the border line.

OPAQUE Specifies whether the title background isopaque.

PAD Specifies the amount of extra space that isreserved inside the title border.

SHORTTEXT Specifies an alternate title to use if the specifiedtitle is too long for the output width.

536 Chapter 52 • ENTRYTITLE Statement

Page 547: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Statement Option Description

TEXTATTRS Specifies the text properties of the entire titletext.

TEXTFITPOLICY Specifies how to handle a title that is too longto fit in the output width.

BACKGROUNDCOLOR=style-reference | colorspecifies the color of the title background.

Default: The GraphBackground:Color style reference.

style-referenceA reference of the form style-element:style-attribute. Only the style-attribute namedCOLOR is used.

Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default,OPAQUE=FALSE.

BORDER=booleanspecifies whether a border is displayed around the title.

Default: FALSE

BORDERATTRS=style-element | style-element (line-options) | (line-options)specifies the attributes of the border line around the title. See “General Syntax forAttribute Options” on page 563 for the syntax on using a style-element and “LineOptions” on page 564 for available line-options.

Default: The GraphBorderLines style element.

Interaction: BORDER=TRUE must be set for this option to have any effect.

HALIGN=CENTER | LEFT | RIGHTprefix-option that specifies the horizontal alignment of a text-item.

Default: CENTER

Each text-item has a horizontal alignment, and text-items with the same alignment arealways concatenated together.

OPAQUE=booleanspecifies whether the title background is opaque (TRUE) or transparent (FALSE).

Default: FALSE

Interaction: When this option is set to FALSE, the background color is not used.

PAD=dimension | (pad-options)specifies the amount of extra space that is reserved inside the title border.

Default: (LEFT=3 RIGHT=3 TOP=0 BOTTOM=0)

dimensionSpecifies a dimension to use for the extra space at the left, right, top, and bottomof the title border.

(pad-options)Enables separate settings for the left, right, top, and bottom padding dimensions.Use the pad-options to create non-uniform padding. These options must be enclosedin parentheses. Each option is specified as a name = value pair. Sides not assignedpadding are padded with the default amount.

Example Program and Statement Details 537

Page 548: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Values without units are in pixels (px). A unit must be provided if other than pixels.

LEFT=dimension specifies the amount of extra space addedto the left side.

RIGHT=dimension specifies the amount of extra space addedto the right side.

TOP=dimension specifies the amount of extra space addedto the top.

BOTTOM=dimension specifies the amount of extra space addedto the bottom.

SHORTTEXT= (text-item <…<text-item>>)specifies an alternate title to use if the specified title is too long for the output width. Ifthe shortened text is itself too long, it is truncated.

Default: no default

Interaction: This option has no effect unless TEXTFITPOLICY=SHORT.

Interaction: This option is ignored if any text-items include an HALIGN= prefixoption.

Interaction: The horizontal alignment of the shortened text is derived from thehorizontal alignment of the title to be shortened.

{ SUB "string" | dynamic }text-command that specifies that the string or dynamic is to appear as subscript text.

Default: no default

Example: entrytitle "y = " b{sub "0"} " + b" {sub "1"} "x";

{ SUP "string" | dynamic }text-command that specifies that the string or dynamic is to appear as superscript text.

Default: no default

Example: entrytitle "R" {sup "2"} " = " RSQUARED;

TEXTATTRS=style-element | style-element (text-options) | (text-options)as a statement option, specifies the text properties of the entire entry text. As a prefix-option, specifies the text properties of individual text-items. See “General Syntax forAttribute Options” for the syntax on using a style-element and “Text Options” on page566 for available text-options.

Default: The GraphTitleText style element.

This option can be used as both a prefix option and a statement option. When used asa prefix option, it overrides the statement option.

When used as a prefix option, TEXTATTRS=( ) cancels the last used TEXTATTRS=prefix option. It resets all text options to those set by 1) the TEXTATTRS= statementoption or 2) the default style element for the statement (GraphTitleText) if noTEXTATTRS= statement option is used.

TEXTFITPOLICY=WRAP | SHORT | TRUNCATEspecifies how to handle a title that is too long to fit in the output width.

Default: WRAP

WRAPspecifies that the text wraps to the next line(s).

538 Chapter 52 • ENTRYTITLE Statement

Page 549: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

SHORTspecifies that the text indicated by the SHORTTEXT= option be substituted whenthe title does not fit.

TRUNCATEspecifies that the text is truncated to make it fit.

Interaction: If you specify SHORT for this option, you should assign a shortenedversion of the title with the SHORTTEXT= option. If the shortened title is itself toolong, it is truncated.

{ UNICODE "hex-string"x | keyword | dynamic }text-command that specifies a glyph (character) to be displayed using its Unicodespecification or keyword equivalent.

Default: no default

"hex-string"xA four-byte hexadecimal constant that represents a UNICODE character in thecurrent font. For a complete listing, see http://unicode.org/charts/charindex.html.

keywordA SAS keyword for a UNICODE character. For a listing of SAS supplied keywords,see “Reserved Keywords and Unicode Values” on page 514.

dynamicThe dynamic must resolve to either "hex-string"x or a keyword for a UNICODEcharacter.

Examples:

entrytitle {unicode alpha} "=" CONF;

entrytitle {unicode "03B1"x} "=" CONF;

This text command attempts to access a UNICODE value in the current font. Not allfonts support accessing characters via their UNICODE value. Some fonts only supporta limited set of UNICODE values. If the UNICODE value is not accessible, thecommand might be ignored or an unprintable character might be substituted.

Example Program and Statement Details 539

Page 550: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

540 Chapter 52 • ENTRYTITLE Statement

Page 551: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 8

Runtime Programming Features

Chapter 53Dynamics and Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543

Chapter 54Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545

Chapter 55Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549

Chapter 56Conditional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553

541

Page 552: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

542

Page 553: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 53

Dynamics and Macro Variables

Template Types on PROC TEMPLATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543

DYNAMIC, MVAR, and NMVAR Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543

Dynamics Compared to Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544

Template Types on PROC TEMPLATEPROC TEMPLATE supports different template types such as COLUMN, TABLE,HEADER, FOOTER, and STATGRAPH. All of these template types support run timevariable substitution via dynamics or macro variables. For STATGRAPH templates suchvariables should be declared within the scope of the template definition before theBEGINGRAPH block.

PROC TEMPLATE; DEFINE STATGRAPH template-name ;

DYNAMIC variable-1<"text-1"> <... variable-n<"text-n">>; MVAR variable-1<"text-1"> <... variable-n<"text-n">>; NMVAR variable-1<"text-1"> <... variable-n<"text-n">>; NOTES "text";

BEGINGRAPH; GTL statements; ENDGRAPH; END; RUN;

DYNAMIC, MVAR, and NMVAR StatementsEach of the DYNAMIC, MVAR, and NMVAR statements can define multiple variablesand an optional text-string denoting its purpose or usage. For example:

DYNAMIC YVAR "required" YLABEL "optional";

543

Page 554: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

MVAR LOCATE "INSIDE or OUTSIDE" SYSDATE;NMVAR TRANS "transparency factor";

Note: For template readability, it is helpful to adopt a naming convention for thesevariables to distinguish them from actual option values or column names. Commonconventions include capitalization, or adding leading or trailing underscores to theirnames.

Dynamics and macro variables can be referenced within the template definition as

• argument or option values. For example:

seriesplot x=date y=YVAR / curvelabel=YLABEL curvelabellocation=LOCATE datatransparency=TRANS;

• parts of some text strings. For example:

entrytitle "Time Series for " YLABEL; entryfootnote "Created on " SYSDATE;

Dynamics and run-time macro variable references cannot resolve to statement or optionkeywords.

Note that macro variable references should not be prefaced with an ampersand (&) if youwant them to resolve at run time.

Macro variables defined by MVAR are strings when they resolve, as with SYMGET() inthe DATA step.

Macro variables defined by NMVAR are converted to numeric tokens when they resolve,as with SYMGETN() in the DATA step.

Dynamics Compared to Macro VariablesThe main difference between dynamics and macro variables is how they are initialized.

For dynamics, use the DYNAMIC statement with PROC SGRENDER. For example,

proc sgrender data=sashelp.class template=timeseries; dynamic yvar="inflation" ylabel="Inflation Rate";run;

Values for dynamics that resolve to column names or strings should be quoted. Numericvalues should not be quoted.

For macro variables, use the current symbol table (local or global) to look up the macrovariable values at run time. For example,

%let locate=inside;%let trans=.3;

proc sgrender data=sashelp.class template=timeseries; dynamic yvar="inflation" ylabel="Inflation Rate";run;

No initialization is needed for system macro variables like SYSDATE.

544 Chapter 53 • Dynamics and Macro Variables

Page 555: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 54

Expressions

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545

GTL Expressions Compared to WHERE Expressions . . . . . . . . . . . . . . . . . . . . . . 546

An expression in Statement Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546

OverviewIn GTL, as in Base SAS, an expression is an arithmetic or logical expression that consistsof a sequence of operators, operands, and functions. An operand is a dynamic, a macrovariable, a column, a function, or a constant. An operator is a symbol that requests acomparison, logical operation, or arithmetic calculation. In GTL, the expression must beenclosed in EVAL.

Expressions can be used set an option value that is

• a constant

• a column

• part of the text for ENTRYTITLE, ENTRYFOOTNOTE, and ENTRY statements.

Example of computing constants:

/* create reference lines at computed positions */ referenceline y=eval(mean(height)+2*std(height)) / curvelabel="+2 STD";referenceline y=eval(mean(height));referenceline y=eval(mean(height)-2*std(height)) / curvelabel="-2 STD";

Example of creating a new column:

/* create a new column as a log transformation */scatterplot x=date y=eval(log10(amount));

Example of building a text string:

/* create a date and time stamp as a footnote */entryfootnote eval(put(today(),date9.)||" : "|| put(time(),timeampm8.));

545

Page 556: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

GTL Expressions Compared to WHEREExpressions

Valid GTL expressions are identical to valid WHERE expressions. See the WHEREstatement documentation in Base SAS for a comprehensive list of operators and operands.However, GTL expressions do not perform subset operations as WHERE expressions do.The major difference in the result of a logical GTL expression on a column is that a Booleanvalue is returned for each observation without changing the number of observations.

For example, in the following line of code, the expression for the Y= argument does notreduce the number of observations plotted.

scatterplot x=name y=eval(height between 40 and 60);

Instead, the computed numeric column for the Y= argument consists of 0s and 1s, basedon whether each observation’s HEIGHT value is between 40 and 60. Whenever expressionsare used to create new columns, a new column name is internally manufactured so it doesnot collide with other columns in use.

An expression in Statement SyntaxThroughout GTL documentation, you see expression used in statement documentation:

BOXPLOT X= column | expressionY= numeric-column | expression < /option(s)>;

For the X= argument, expression means any EVAL(expression) that results in either anumeric or character column. An expression that yields a constant is not valid because theX= argument does not accept constants.

Similarly, for the Y= argument, expression means any EVAL(expression) that results in anumeric column. The expression cannot result in a character column or any constantbecause the Y= argument only accepts a numeric column.

On the following REFERENCELINE statement, the X= argument can be a constant (singleline) or a column (multiple lines) that has the same data type as the axis. This means thatEVAL(expression) can result in a numeric or character column or constant that agrees withthe axis type.

REFERENCELINE X= x-axis-value | column | expression </option(s)>;

Automatic Type Conversion. Although expressions that are used in a DATA step performautomatic type conversion, GTL expression evaluation does not. Thus, you must usefunction(s) to perform required type conversions in an expression. Otherwise, theexpression generates an error condition without warning when the template is executed.

For example, consider the following GTL expression:

if(substr(value, 1, 2) = "11")

This expression uses the SUBSTR function to determine whether the first two charactersfrom VALUE evaluate to the string value "11". If VALUE is a string, the expression worksfine. However, if VALUE is numeric, the expression generates an error condition. For a

546 Chapter 54 • Expressions

Page 557: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

numeric, you must convert the value to a string before passing it to the SUBSTR function.The following modification uses the CATS function to perform the type conversion whennecessary:

if(substr(cats(value, 1, 2)) = "11")

An expression in Statement Syntax 547

Page 558: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

548 Chapter 54 • Expressions

Page 559: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 55

Functions

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549

Functions Used Only in GTL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549

GTL Summary Statistic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550

OverviewGTL supports a large number of functions

• SAS functions that can be used in the context of a WHERE expression

• functions defined only in GTL.

SAS functions that can be used in a WHERE expression include

• character handling functions

• date and time functions

• mathematical and statistical functions.

Note: Not all SAS functions are available in WHERE expressions. Call routines and otherDATA-step-only functions (for example, LAG, VNAME, OPEN) are some examplesof functions that cannot be used.

Functions Used Only in GTLThe following table shows some functions that are used only in GTL. As with otherfunctions, these must be enclosed within an EVAL. In all these functions, column can beeither the name of a column in the input data set or a dynamic / macro variable that resolvesto such a column.

Function Name Description

COLNAME(column) returns the case-sensitive name of the column.

549

Page 560: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Function Name Description

COLLABEL(column) returns the case-sensitive label of the column.If no label is defined for the column, the case-sensitive name of the column is returned.

EXISTS(item) returns 1 if specified item exists, 0 otherwise. Ifitem is a column, it tests for the presence of thecolumn in the input data set. If item is adynamic / macro variable, it tests whether therehas been a run-time initialization of thevariable.

EXPAND(numeric-column, freq-column) creates a new column as (numeric-column *frequency-column)

ASORT(column, RETAIN=ALL) sorts all columns of the data object by the valuesof column in ascending order. SORT is an aliasfor ASORT.

Warning: if the RETAIN=ALL argument isnot included, column alone is sorted, not theother columns, causing rowwise information tobe lost.

DSORT(column, RETAIN=ALL) sorts all columns of the data object by the valuesof column in descending order.

Warning: if the RETAIN=ALL argument isnot included, column alone is sorted, not theother columns, causing rowwise information tobe lost.

NUMERATE(column) returns a column that contains the ordinalposition of each observation in the input dataset (similar to an OBS column)

Examples:

/* arrange bars in descending order of response values */ barchartparm x=region y=eval(dsort(amount,retain=all));

/* label outliers with their position in the data set *//* it does not matter which column is used for NUMERATE() */boxplot x=age y=weight / datalabel=eval(numerate(age));

/* add information about the column being processed, which is passed by a dynamic */entrytitle "Distribution for " eval(colname(DYNVAR));

GTL Summary Statistic FunctionsThe following functions return a numeric constant, based on a summary operation on anumeric column. The results are the same as if the corresponding statistics were requested

550 Chapter 55 • Functions

Page 561: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

with PROC SUMMARY. These functions take a single argument that resolves to the nameof a numeric column. These functions take precedence over similar multi-argument DATAstep functions.

number = EVAL(function-name(numeric-column))

Function Name Description

CSS Corrected sum of squares

CV Coefficient of variation

KURTOSIS Kurtosis

LCLM One-sided confidence limit below the mean

MAX Largest (maximum) value

MEAN Mean

MEDIAN Median (50th percentile)

MIN Smallest (minimum) value

N Number of nonmissing values

NMISS Number of missing values

P1 1st percentile

P5 5th percentile

P25 25th percentile

P50 50th percentile

P75 75th percentile

P90 90th percentile

P95 95th percentile

P99 99th percentile

PROBT p-value for Student’s t statistic

Q1 First quartile

Q3 Third quartile

QRANGE Interquartile range

RANGE Range

GTL Summary Statistic Functions 551

Page 562: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

number = EVAL(function-name(numeric-column))

Function Name Description

SKEWNESS Skewness

STDDEV Standard deviation

STDERR Standard error of the mean

SUM Sum

SUMWGT Sum of weights

T Student’s t statistic

UCLM One-sided confidence limit above the mean

USS Uncorrected sum of squares

VAR Variance

552 Chapter 55 • Functions

Page 563: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Chapter 56

Conditional Logic

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553

Conditional Logic Determines Statement Rendering . . . . . . . . . . . . . . . . . . . . . . . 554

GTL Does Not Provide ELSE IF Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555

OverviewGTL supports conditional logic that enables you to include or exclude one or more GTLstatements at run time:

IF (condition)GTL-statement(s);

ELSEGTL-statement(s);

ENDIF;

The IF statement requires an ENDIF statement. The IF block can be placed anywhere withinthe BEGINGRAPH / ENDGRAPH block.

The condition is an expression that evaluates to a numeric constant, where all numericconstants other than 0 and MISSING are true. There is an implied EVAL(condition), so itis not necessary to include an EVAL as part of the condition.

Examples:

/* test a computed value */ if (weekday(today()) in (1 7)) entrytitle "Run during the work week";else entrytitle "Run during the weekend";endif;

/* test for the value a numeric dynamic */ if ( ADDREF > 0 ) referenceline y=1; referenceline y=0; referenceline y=-1; endif;

/* test for the value a character dynamic */

553

Page 564: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

if ( upcase(ADDREF) =: "Y") referenceline y=1; referenceline y=0; referenceline y=-1; endif;

/* test whether a dynamic is initialized */ if (exists(ADDREF)) referenceline y=1; referenceline y=0; referenceline y=-1; endif;

Conditional Logic Determines StatementRendering

The GTL conditional logic is used only to determine which statements are rendered, notto control what is in the data object. In the following example, the data object containscolumns for DATE, AMOUNT, and LOG(AMOUNT), but only one scatter plot is created.

if ( LOGFLAG ) scatterplot x=date y=amount; else scatterplot x=date y=log(amount);endif;

Also, it is seldom necessary to test for the existence of option values set by columns ordynamics. Consider the following statement:

scatterplot x=date y=amount / group=GROUPVAR;

This SCATTERPLOT statement is equivalent to the following code because option valuesset by columns that do not exist or dynamics that are uninitialized simply “drop out” at runtime and do not produce errors or warnings:

if ( exists(GROUPVAR) ) scatterplot x=date y=amount / group=GROUPVAR; else scatterplot x=date y=amount;endif;

The GTL code that is conditional must be complete statements, or complete blocks ofstatements, or both. The following IF block produces a compile error because there aremore LAYOUT statements than ENDLAYOUT statements:

/* this IF block produces a compile error */if ( exists(SQUAREPLOT) ) layout overlayequated / equatetype=square;else layout overlay;endif;

554 Chapter 56 • Conditional Logic

Page 565: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

scatterplot x=XVAR y=YVAR;endlayout;

This is the correct conditional construct:

if ( exists(SQUAREPLOT) ) layout overlayequated / equatetype=square; scatterplot x=XVAR y=YVAR; endlayout;else layout overlay; scatterplot x=XVAR y=YVAR; endlayout; endif;

GTL Does Not Provide ELSE IF SyntaxThe GTL does not provide ELSE IF syntax, but you can create a nested IF/ELSE block asfollows:

IF (condition-1)GTL-statement(s);

ELSEIF (condition-2)

GTL-statement(s);ELSE

GTL-statement(s);ENDIF;

ENDIF;

GTL Does Not Provide ELSE IF Syntax 555

Page 566: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

556 Chapter 56 • Conditional Logic

Page 567: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Part 9

Appendices

Appendix 1Syntax Conventions and Argument Value Types . . . . . . . . . . . . . . . . 559

Appendix 2Display Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563

Appendix 3SAS Formats Not Supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569

Appendix 4Computing Input Data for BOXPLOTPARM . . . . . . . . . . . . . . . . . . . . . . 573

Appendix 5Memory Management for ODS Graphics . . . . . . . . . . . . . . . . . . . . . . . . . 579

557

Page 568: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

558

Page 569: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Appendix 1

Syntax Conventions andArgument Value Types

Syntax Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

Value Types for Statement Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

Syntax Conventions< > ==> optional

a | b ==> either a or b

Value Types for Statement OptionsThe default value of an option depends on the template definition that is in use, and theimplementation of that option depends on the ODS destination that formats the output. Inaddition, if you are creating HTML output, the implementation of an attribute depends onthe browser that you use.

This section describes the value types that are available for GTL statement options.

arrowspecifies a string value of an arrow shape, a dynamic variable that contains an arrowshape, or a style reference to an arrow shape.

booleanspecifies a string value that is true or false, or a style reference to a Boolean value.

For all attributes that support a value of ON, the following forms are equivalent:

ATTRIBUTE-NAMEATTRIBUTE-NAME=ON

For all attributes that support a value of column, column can be any variable that youdeclare in the GTL template with the DYNAMIC, MVAR, or NMVAR statement. If

559

Page 570: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

the attribute is a Boolean value, then the value of variable should resolve to either trueor false. The following values represent a true or false value.

Values for True Values for False

True False

ON OFF

_ON_ _OFF_

TRUE FALSE

YES NO

_YES_ _NO_

1 0

colorspecifies a string that identifies a color. A color can be one of the following:

• any of the color names that are supported by SAS/GRAPH. These names include

• a predefined SAS color (for example, blue or VIYG)

• a red/green/blue (RGB) value (for example, CX0023FF or #0023FF)

• a hue/light/saturation (HLS) value (for example, H14E162D)

• a gray-scale value (for example, GRAYBB).

• one of the colors that exists in the SAS session when the style definition is used,such as DMSBLACK or DMSCYAN. (Use these color specifications only if youare running SAS in the windowing environment.)

• an English description of an Hue/Light/Saturation (HLS) value. Such descriptionsuse a combination of words to describe the lightness, the saturation, and the hue (inthat order). You can use the Color Naming System to form a color by doing one ofthe following:

• combining a chromatic hue with a lightness, a saturation, or both

• combining the achromatic hue gray with a lightness

• combining the achromatic hue black or white without qualifiers.

• combining words to form a wide variety of colors, such as light vivid green,dark vivid orange, or light yellow.

• specify hues that are intermediate between two neighboring colors. To do so,combine one of the following adjectives with one of its neighboring colors:brownish, greenish, purplish, or yellowish. For example, bluish purple or reddishorange.

For information about using SAS/GRAPH colors, seeSAS/GRAPH: Reference .

columnspecifies a column variable that contains either double-precision values or string values,or a dynamic variable that refers to such a column variable.

See also: integer-column, numeric-column, and string-column.

560 Appendix 1 • Syntax Conventions and Argument Value Types

Page 571: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

dimensionspecifies a nonnegative number. The number can be followed by one of the followingoptional units of measure:

Unit Description

% percentage

PX pixels

PT point size, calculated at 100 dots per inch

The default value for the Printer destination is units of 1/150 of an inch.

expressionspecifies a selective, relational, or logical program structure that calculates values whenthose values are not stored in the data. The expression must be specified as an EVAL()argument. The following shows the structure of an EVAL() argument:

x = EVAL(expression)

The expression returns a number and can be formed with consonants, data columns,dynamic variables, functions, or other expressions. The following example uses thedata column Time and the SGE functions MEAN and ACF:

EVAL( MEAN( Time ) + ACF( Time, NLags=10 ))

For more information about expressions, see Chapter 54, “Expressions,” on page 545.

formatspecifies a SAS format or a user-defined format.

integer, integer-columnspecifies a member of the set of positive whole numbers, negative whole numbers, andzero.

An integer-column specifies a column variable that contains integer values, or adynamic variable that refers to such a column variable.

line-pattern-name, line-pattern-numberspecifies a string value of a line pattern, a numeric value of a line pattern, a dynamicvariable that contains such a string or number, or a style reference to a line pattern. Linepatterns are chosen for discriminability. Because of different densities, equal weightingis impossible for lines of the same thickness. Instead, line patterns are ordered to providea continuum of weights, which is useful when displaying confidence bands.

For details about line attributes, see “Line Options” on page 564.

marker-namespecifies a string value of a maker symbol, a dynamic variable that contains a markersymbol, or a style reference to a marker symbol.

For details about marker attributes, see “Marker Options” on page 565.

number, numeric-columnspecifies a value, a dynamic variable that contains a double-precision value, anexpression that resolves to a double-precision value, or a style reference to a double-precision value.

Value Types for Statement Options 561

Page 572: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

A numeric-column specifies a column variable that contains double-precision values,or a dynamic variable that refers to such a column variable.

string, string-columnspecifies a quoted character string.

A string-column specifies a column variable that contains string values, or a dynamicvariable that refers to such a column variable.

style-referencespecifies a reference to an attribute that is defined in a style element.

In the ODS Graphics templates that SAS provides, options for plot features are specifiedwith a style reference in the form style-element:attribute, rather than a specific value.For example, the symbol, color, and size of markers for a basic scatter plot is specifiedin a SCATTERPLOT statement as follows:

scatterplot x=X y=Y / markersymbol=GraphDataDefault:markersymbol markercolor=GraphDataDefault:contrastcolor markersize=GraphDataDefault:markersize

The above style references guarantee a common appearance for markers used in allbasic scatter plots. For non-grouped data, the marker appearance is controlled by theGraphDataDefault style element in the style definition that you specify.

In order to create your own style definition, or to modify a style definition to use withODS Graphics, you need to understand the relationship between style elements andgraph features. For more information, see the usage guide.

562 Appendix 1 • Syntax Conventions and Argument Value Types

Page 573: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Appendix 2

Display Attributes

General Syntax for Attribute Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563

Attributes Available for the Attribute Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564Fill Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564Marker Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565Text Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566

Available Line Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566

General Syntax for Attribute OptionsMost statements provide options that enable you to specify attributes for the fills, lines,data markers, or text that is used in the display. For example, many plots provide aDATALABELATTRS= option that specifies the attributes of the data labels. This appendixdiscusses the general syntax for those options and the valid values for they accept.

A statement’s attribute options use the following general syntax:

OPTIONATTRS = style-element | style-element (options) | (options)

style-elementName of a style element. Only style attributes relevant for rendering the fill, line, datamarker, or text are used. Example:

DATALABELATTRS=GRAPHVALUETEXT

style-element (options)Name of a style element, plus individual options to be used as style overrides. Anyoptions not specified are derived from the specified style-element.Example:

DATALABELATTRS=GRAPHVALUETEXT(SIZE=10pt)

(options)Individual options. Any options not specified are derived from the default style element.Examples:

DATALABELATTRS=(FAMILY="Arial" SIZE=10pt)DATALABELATTRS=(FAMILY=GraphValueText:FontFamily)

563

Page 574: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Depending on the attribute option used, the options might be fill-options on page 564,line-options on page 564, marker-options on page 565, or text-options on page 566.

In general, any relevant attribute that is not specified default to some internal value,typically those from the default style element of the style-element you specify for theattributes. When choosing a style element, you should use an element of the correct type.SeeSAS Output Delivery System: Procedures Guide for a list of style elements and theirtypes.

Attributes Available for the Attribute OptionsDepending on the attribute option used on a statement, the available attributes might befill-options on page 564, line-options on page 564, marker-options on page 565, ortext-options on page 566.

Fill OptionsWhen specifying the attributes for an area fill, the COLOR fill-option is the only optionthat is currently available. The option must be enclosed in parentheses and specified as aname = value pair. The value can be a style-reference in the form style-element:style-attribute.

COLOR=style-reference | colorspecifies the fill color. If you use a style-reference, the style-attribute should be a validattribute such as COLOR, CONTRASTCOLOR, STARTCOLOR, NEUTRAL,ENDCOLOR. The convention is to use the COLOR attribute for fill areas.

If you use a color, SAS/GRAPH accepts color names, such as RED, or color codes,such as CXFF0000 or #FF0000. Color names must not exceed 64 characters. Colorcodes must not exceed 8 characters and must be in a valid SAS color-naming scheme,such as RGB, CMYK, HLS, or HSV (HSB).

For more information about using colors in SAS/GRAPH, see the discussion on colorin SAS/GRAPH: Reference .

Line OptionsWhen specifying the attributes for a line, the available line-options can be any one or moreof the following settings. The options must be enclosed in parentheses, and each option isspecified as a name = value pair. In all cases, the value can be a style-reference in the formstyle-element:style-attribute.

COLOR=style-reference | colorspecifies the line color. If you use a style-reference, the style-attribute should be a validattribute such as COLOR, CONTRASTCOLOR, STARTCOLOR, NEUTRAL,ENDCOLOR. The convention is to use CONTRASTCOLOR for lines. If you specifya style element that does not have a CONTRASTCOLOR attribute, the element’sCOLOR attribute is used.

If you use a color, SAS/GRAPH accepts color names, such as RED, or color codes,such as CXFF0000 or #FF0000. Color names must not exceed 64 characters. Colorcodes must not exceed 8 characters and must be in a valid SAS color-naming scheme,such as RGB, CMYK, HLS, or HSV (HSB).

For more information about using colors in SAS/GRAPH, see the discussion on colorin SAS/GRAPH: Reference .

564 Appendix 2 • Display Attributes

Page 575: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PATTERN=style-reference | line-pattern-name | line-pattern-numberspecifies the line pattern. If you use a style-reference, the style-attribute should beLINESTYLE.

Line patterns can be specified as a pattern name or pattern number.

Valid pattern numbers range from 1 to 46. Not all pattern numbers have names. See“Available Line Patterns” on page 566 for a list of all possible line patterns. Werecommend that you use the named patterns because they have been optimized toprovide good discriminability when used in the same plot.

THICKNESS=style-reference | dimensionspecifies the line thickness. If you use a style-reference, the style-attribute should beLINETHICKNESS.

Marker OptionsWhen specifying the attributes for a data marker, the available marker-options can be anyone or more of the following settings. The options must be enclosed in parentheses, andeach option is specified as a name = value pair. In all cases, the value can be a style-reference in the form style-element:style-attribute.

COLOR=style-reference | colorspecifies the color of the marker. If you use a style-reference, the style-attribute shouldbe a valid attribute such as COLOR, CONTRASTCOLOR, STARTCOLOR,NEUTRAL, ENDCOLOR. The convention is to use CONTRASTCOLOR for markers.For grouped data, this option keeps all markers the same color and the marker symbolalone distinguishes the group values.

If you use a color, SAS/GRAPH accepts color names, such as RED, or color codes,such as CXFF0000 or #FF0000. Color names must not exceed 64 characters. Colorcodes must not exceed 8 characters and must be in a valid SAS color-naming scheme,such as RGB, CMYK, HLS, or HSV (HSB).

For more information about using colors in SAS/GRAPH, see the discussion on colorin SAS/GRAPH: Reference .

SIZE=style-reference | dimensionspecifies the marker size (both width and height). If you use a style-reference, the style-attribute should be MARKERSIZE.

SYMBOL=style-reference | marker-namespecifies the name of the marker. If you use a style-reference, the style-attribute shouldbe MARKERSYMBOL. The following symbols are supported:

Attributes Available for the Attribute Options 565

Page 576: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

WEIGHT=NORMAL | BOLDspecifies the marker weight.

Text OptionsWhen specifying the attributes for text, the available text-options can be any one or moreof the following settings. The options must be enclosed in parentheses, and each option isspecified as a name = value pair. In all cases, the value can be a style-reference in the formstyle-element:style-attribute.

COLOR=style-reference | colorspecifies the color of the text. If you use a style-reference, the style-attribute should bea valid attribute such as COLOR, CONTRASTCOLOR, STARTCOLOR, NEUTRAL,ENDCOLOR. The convention is to use COLOR for text.

If you use a color, SAS/GRAPH accepts color names, such as RED, or color codes,such as CXFF0000 or #FF0000. Color names must not exceed 64 characters. Colorcodes must not exceed 8 characters and must be in a valid SAS color-naming scheme,such as RGB, CMYK, HLS, or HSV (HSB).

For more information about using colors in SAS/GRAPH, see the discussion on colorin SAS/GRAPH: Reference .

FAMILY =style-reference | "string"specifies the font family of the text. If you use a style-reference, the style-attributeshould be FONTFAMILY.

SIZE=style-reference | dimensionspecifies the font size of the text. If you use a style-reference, the style-attribute shouldbe FONTSIZE.

STYLE=style-reference | NORMAL | ITALICspecifies the font style of the text. If you use a style-reference, the style-attribute shouldbe FONTSTYLE.

WEIGHT=style-reference | NORMAL | BOLDspecifies the font weight of the text. If you use a style-reference, the style-attributeshould be FONTWEIGHT.

Available Line PatternsThe following line patterns can be used with the Graphics Template Language. A linepattern can be specified by its number or name. Not all patterns have names. We recommendthat you use the named patterns because they have been optimized to provide gooddiscriminability when used in the same plot.

566 Appendix 2 • Display Attributes

Page 577: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Available Line Patterns 567

Page 578: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

568 Appendix 2 • Display Attributes

Page 579: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Appendix 3

SAS Formats Not Supported

Using SAS Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569

Unsupported Numeric Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569

Unsupported Date and Time Formats Related to IS0 8601 . . . . . . . . . . . . . . . . . . 570

Other Unsupported Date and Time Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570

Unsupported Currency Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571

Using SAS FormatsSAS formats can be assigned to input data columns with the FORMAT statement of theSGRENDER procedure. Additionally, several GTL statement options enable a SAS formatas an option value. Examples include the TICKVALUEFORMAT= option for formattingaxis tick values, and the TIPFORMAT= option for formatting data tips.

Not all SAS formats are supported in the GTL or with the SGPLOT, SGSCATTER,SGPANEL, and SGRENDER procedures. The tables in the following sections show thecharacter and numeric SAS formats that are not supported.

When the GTL encounters an unsupported format, a note similar to the following is writtento the SAS log:

TICKVALUEFORMAT=bestx. is invalid. The format is invalid or unsupported. The default will be used.

Unsupported Numeric FormatsThe following numeric formats are not supported in the GTL:

BESTD BESTX D FLOAT FRACT

FREE IB IBR IEEE IEEER

ODDSR PCPIB PD PIB PIBR

569

Page 580: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PK RB SSN WORDF WORDS

Z ZD

Unsupported Date and Time Formats Related to IS08601

The following date and time formats are not supported in the GTL:

$N8601B $N8601BA $N8601E $N8601EA $N8601EH

$N8601EX $N8601H $N8601X B8601DA B8601DN

B8601DT B8601DZ B8601LZ B8601TM B8601TZ

E8601DA E8601DN E8601DT E8601DZ E8601LZ

E8601TM E8601TZ IS8601DA IS8601DN IS8601DT

IS8601DZ IS8601LZ IS8601TM IS8601TZ

Other Unsupported Date and Time FormatsThe following date and time formats are not supported in the GTL:

HDATE HEBDATE JDATEMDW JDATEMNW JDATEWK

JDATEYDW JDATEYM JDATEYMD JDATEYMW JDATEYT

JDATEYTW JNENGO JNENGOT JNENGOTW JNENGOW

JTIMEH JTIMEHM JTIMEHMS JTIMEHW JTIMEMW

JTIMESW MDYAMPM MINGUO NENGO NLDATEYQ

NLDATEYR NLDATEYW NLDATMYQ NLDATMYR NLDATMYW

NLSTRMON NLSTRQTR NLSTRWK PDJULG PDJULI

TWMDY XYYMMDD YYQZ

570 Appendix 3 • SAS Formats Not Supported

Page 581: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Unsupported Currency FormatsThe following currency formats are not supported in the GTL:

EURFRATS EURFRBEF EURFRCHF EURFRCZK EURFRDEM

EURFRDKK EURFRESP EURFRFIM EURFRFRF EURFRGBP

EURFRGRD EURFRHUF EURFRIEP EURFRITL EURFRLUF

EURFRNLG EURFRNOK EURFRPLZ EURFRPTE EURFRROL

EURFRRUR EURFRSEK EURFRSIT EURFRTRL EURFRYUD

EURTOATS EURTOBEF EURTOCHF EURTOCZK EURTODEM

EURTODKK EURTOESP EURTOFIM EURTOFRF EURTOGBP

EURTOGRD EURTOHUF EURTOIEP EURTOITL EURTOLUF

EURTONLG EURTONOK EURTOPLZ EURTOPTE EURTOROL

EURTORUR EURTOSEK EURTOSIT EURTOTRL EURTOYUD

Unsupported Currency Formats 571

Page 582: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

572 Appendix 3 • SAS Formats Not Supported

Page 583: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Appendix 4

Computing Input Data forBOXPLOTPARM

The following SAS code is a generalized macro for computing input data forBOXPLOTPARM.

%macro boxcompute(indsn=,x=,y=,outdsn=boxdata,datalabel=, qntldef=5,table=no);/* NOTE: INDSN, X and Y are required parameters, where INDSN = input SAS data set X = categorical variable (num or char) Y = response variable (num) OUTDSN = output dataset. It contains these variables: STAT: Statistic names for BOXPLOTPARM VALUE: values for STAT type X: X variable values DATALABEL: outlier labels from the DATALABEL= variable N, Mean, Median, Std if TABLE=YES DATALABEL= variable used to label outliers (num or char) QNTLDEF = 1|2|3|4|5 (how to compute quantiles - see PROC SUMMARY) TABLE = YES | NO (add additional data to build table of statistics) */ %macro varinfo(dsid,varname,role,rc); /* utility macro for obtaining variable info */ %local varnum; %if %length(&varname)=0 %then %do; %let &rc=0; %return; %end; %let varnum=%sysfunc(varnum(&dsid,&varname)); %if &varnum > 0 %then %do; %let &role.label=%sysfunc(varlabel(&dsid,&varnum)); %if %length(&&&role.label)=0 %then %let &role.label=%sysfunc(varname(&dsid,&varnum)); %let &role.fmt=%sysfunc(varfmt(&dsid,&varnum)); %let &rc=0; %end; %else %do; %put ERROR: %upcase(&role) variable &varname not found.; %let &rc=1; %end; %mend varinfo;

/* validate dataset and variables */%local dsid ylabel xlabel datalabellabel yfmt xfmt datalabelfmt rc_y rc_x rc_d;

573

Page 584: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

%let dsid=%sysfunc(open(&indsn));%if &dsid %then %do; %varinfo(&dsid,&y,Y,rc_y) %varinfo(&dsid,&x,X,rc_x) %if %length(&datalabel) %then %varinfo(&dsid,&datalabel,DATALABEL,rc_d); %else %let rc_d=0; %let dsid=%sysfunc(close(&dsid)); %if &rc_y or &rc_x or &rc_d %then %return;%end;%else %do; %put ERROR: Input dataset &indsn not found.; %return;%end;

/* compute basic summary statistics */proc summary data=&indsn(rename=(&y=VALUE &x=X)) nway qntldef=&qntldef; class x; var value; output out=summary(drop=_type_ _freq_) n=N mean=Mean median=Median q1=Q1 q3=Q3 std=STD / noinherit;run;proc sort data=&indsn(keep=&x &y &datalabel) %if %length(&datalabel) %then out=sorted(rename=(&x=X &y=VALUE &datalabel=DATALABEL)); %else out=sorted(rename=(&x=X &y=VALUE));; by &x;run;/* compute fences, MIN, MAX and any outliers for X values */data outliers; length STAT $10; %if %length(&datalabel) %then %do; keep STAT X VALUE DATALABEL; label VALUE="&ylabel" X="&xlabel" DATALABEL="&datalabellabel"; format VALUE &yfmt X &xfmt DATALABEL &datalabelfmt; %end; %else %do; keep STAT X VALUE; label VALUE="&ylabel" X="&xlabel"; format VALUE &yfmt X &xfmt; %end; retain lowerFence upperFence farLowerFence farUpperFence tempmin tempmax; merge sorted summary; by x;

/* perform computations for each X value */ if first.X then do; lowerFence=q1-((q3-q1)*1.5); upperFence=q3+((q3-q1)*1.5); farLowerFence=q1-((q3-q1)*3); farUpperFence=q3+((q3-q1)*3); /* these computations for MIN and MAX result

574 Appendix 4 • Computing Input Data for BOXPLOTPARM

Page 585: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

in the same values produced by the BOXPLOT statement, however they can be modified to satify other statistical definitions */ if value <= upperFence then tempmax=value; else tempmax=.; if value => lowerFence then tempmin=value; else tempmin=.; end; /* recompute MAX and MIN for each obs */ if 0 <= sum(upperFence,-value) then tempmax=max(tempmax,value); if 0 <= sum(value,-lowerFence) then tempmin=min(tempmin,value); /* write out both types of outliers */ if value < farLowerFence or value > farUpperFence then do; stat="FAROUTLIER"; output; end; else if value < LowerFence or value > UpperFence then do; stat="OUTLIER"; output; end; /* write out MIN and MAX for each X value */ if last.X then do; value=tempmin; stat="MIN"; output; value=tempmax; stat="MAX"; output; end;run;/* transpose the stats into the columns required by BOXPLOTPARM */data transpose(keep=x stat value); length STAT $10; set summary; array stats{*} n--std; do i=1 to dim(stats); stat=upcase(vname(stats{i})); VALUE=stats{i}; output; end;run;/* interleave the obs by the X variable */data &outdsn; set transpose outliers; by X;run;/* merge the output stats for building a stat table */%if %upcase(&table)=YES %then %do; data &outdsn; merge &outdsn summary; by X; run;%end;%mend boxcompute;

Here is the macro invocation to produce the data for the graph shown in the section“Example Program and Statement Details” on page 191 of “BOXPLOTPARM Statement”on page 191 .

%boxcompute(indsn=sashelp.cars,x=type,y=mpg_city, datalabel=make);

Unsupported Currency Formats 575

Page 586: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

proc template; define statgraph boxplotparm1; begingraph; entrytitle "City Mileage for Vehicle Types"; layout overlay; boxplotparm y=value x=x stat=stat / datalabel=datalabel spread=true ; endlayout; endgraph; end;run; proc sgrender data=boxdata template=boxplotparm1;run;

The following figure and code show an example of a “table” of statistics withBLOCKPLOT statements.

%boxcompute(indsn=sashelp.cars,x=type,y=mpg_highway, outdsn=boxdata2,table=yes);

proc template; define statgraph boxplotparm2; begingraph; entrytitle "Highway Mileage for Vehicle Types"; layout lattice / rowweights=(.04 .04 .04 .04 .84); blockplot x=x block=n / display=(values label outline) valuehalign=center labelattrs=graphdatatext valueattrs=graphdatatext; blockplot x=x block=std / display=(values label outline) valuehalign=center labelattrs=graphdatatext valueattrs=graphdatatext; blockplot x=x block=mean /

576 Appendix 4 • Computing Input Data for BOXPLOTPARM

Page 587: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

display=(values label outline) valuehalign=center labelattrs=graphdatatext valueattrs=graphdatatext; blockplot x=x block=median / display=(values label outline) valuehalign=center labelattrs=graphdatatext valueattrs=graphdatatext; boxplotparm y=value x=x stat=stat / datalabel=datalabel spread=true; endlayout; endgraph; end;run; proc sgrender data=boxdata2 template=boxplotparm2;run;

Unsupported Currency Formats 577

Page 588: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

578 Appendix 4 • Computing Input Data for BOXPLOTPARM

Page 589: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Appendix 5

Memory Management for ODSGraphics

SAS Options Affecting Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579

Managing a Java Out Of Memory Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579

SAS Options Affecting MemoryODS Graphics uses Java technology to produce its graphs. Most of the time this fact istransparent to you because the required Java Runtime Environment (JRE) and Jar files areincluded with SAS software installation. Also, the Java environment is automaticallystarted and stopped for you. When Java is started, it allocates a fixed amount of memory.The memory can grow up to the value set for the -Xmx suboption in the JREOPTIONSoption (discussed in a moment). This memory is independent of the memory limit that SASsets for the SAS session with its MEMSIZE= option.

Normally, the memory limit for Java is sufficient for most ODS Graphics applications.However, some tasks are very memory intensive and might exhaust all available Javamemory, resulting in an OutOfMemoryError condition. You might encounter Java memorylimitations when

• the product of the output size and the DPI setting results in very large output

• a classification panel has a very large number of classifier crossings

• a scatter plot matrix has a large number of variables

• creating 3-D plots and 2-D contours, which are memory intensive to generate

• a plot has a very large number of marker labels

• a plot uses many character variables or has a large number of GROUP values

• using the SG Editor to edit a graph with a large amount of data.

Managing a Java Out Of Memory ErrorIf you encounter a Java OutOfMemoryError, you can try executing your program again byrestarting SAS and specifying a larger amount of memory for Java at SAS invocation.

To determine what the current Java memory settings are, you can submit a PROCOPTIONS statement that shows the value of the JREOPTIONS option:

579

Page 590: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

proc options option=jreoptions; run;

After you submit this procedure code, a list of JREOPTIONS settings is displayed in theSAS log. The JREOPTIONS option has many suboptions that configure the SAS Javaenvironment. Many of the suboptions are installation and host specific and should not bemodified, especially the ones that provide installed file locations. For managing memory,look for the -Xmx and -Xms suboptions:

JREOPTIONS=( /* other Java suboptions */ -Xmx128m -Xms128m )

-XmsUse this option to set the minimum Java memory (heap) size, in bytes. Set this valueto a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes,or m or M to indicate megabytes. The default is 2MB. Examples:

-Xms6291456-Xms6144k-Xms6m

-XmxUse this option to set the maximum size, in bytes, of the memory allocation pool. Setthis value to a multiple of 1024 greater than 2MB. Append the letter k or K to indicatekilobytes, or m or M to indicate megabytes. The default is 64MB. Examples:

-Xmx83886080-Xmx81920k-Xmx80m

As a general rule, you should set the minimum heap size (-Xms) equal to the maximumheap size (-Xmx) to minimize garbage collections.

Typically, SAS sets both -Xms and -Xmx to be about 1/4 of the total available memory ora maximum of 128M. However, you can set a more aggressive maximum memory (heap)size, but it should never be more than 1/2 of physical memory.

You should be aware of the maximum amount of physical memory your computer hasavailable. Let us assume that doubling the Java memory allocation is feasible. So whenyou start SAS from a system prompt, you can add the following option:

-jreoptions (-Xmx256m -Xms256m)

Alternatively, you might need to specify the setting in quotation marks:

-jreoptions '(-Xmx256m -Xms256m)'

The exact syntax varies for specifying Java options, depending on your operating system,and the amount of memory that you can allocate varies from system to system. The set ofJRE options must be enclosed in parentheses. If you specify multiple JREOPTIONS systemoptions, SAS appends JRE options to JRE options that are currently defined. Incorrect JREoptions are ignored.

If you choose to create a custom configuration file, you would simply replace the existing-Xms and -Xmx suboption values in the JREOPTIONS=(all Java options) portion of theconfiguration file.

For more information, see the SAS Companion for your operating system.

580 Appendix 5 • Memory Management for ODS Graphics

Page 591: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Glossary

anti-aliasinga rendering technique for improving the appearance of text and curved lines in a graphby blurring the jagged edges normally present. The degree of improvement is relativeto the nature of the graphical content (for example, vertical and horizontal lines do notbenefit from anti-aliasing). Extra processing is required to perform anti-aliasing.

attribute bundlea common collection of visual properties associated with a graphical primitive such asa line, marker, or text. For example, all lines have visual properties of pattern, thickness,and color. All markers have visual properties of symbol, size, weight, and color.Attribute bundles can be associated with style elements in order to indirectly assignvisual properties.

axisa graphical element used to locate or identify the values of other graphical elements,such as points or bars. An axis consists of an axis line with tick marks, tick values, anda descriptive label. Not all parts of the axis need to be displayed. An axis is typicallyan interval axis (linear, log, or time) or a discrete axis. A two-dimensional graph canhave up to four independent axes: X, Y, X2, and Y2. A three-dimensional graph hasthree independent axes: X, Y, and Z.

axis offsetthe gaps that normally appear at the ends of an axis line. The gaps enable markers, bars,and other graphic primitives that are drawn at extreme data values to be renderedwithout clipping. An offset can also be used to add extra space between an axis lineand visual elements in the graph. An offset distance is expressed as a value from 0 to1, which represents a percentage of axis length to the axis data minimum or axis datamaximum. An offset can be specified for either end of any axis.

axis thresholda numerical bias from 0 to 1 that determines whether an extra tick is added at eitherend of a non-discrete, interval axis. If the minimum and maximum thresholds are setto 0, then no ticks are added beyond the actual data range. If both minimum andmaximum thresholds are set to 1, then the data range is completely bounded by the firstand last ticks.

axis ticka short line segment perpendicular to the axis line. A tick can cross the axis line, or bedrawn from the axis inside or outside the wall.

581

Page 592: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

axis tick valuea formatted data value represented by a tick.

axis typea keyword denoting axis functionality. For example, the axis type of interval axes canbe LINEAR, TIME, or LOG. The axis type of a discrete axis is DISCRETE.

axis viewportthe range of values displayed on an interval axis. This range can be larger or smallerthan the actual data range of the axis. An axis viewport that is larger than the data rangeeffectively zooms out from the plot or plots. An axis viewport that is smaller than thedata range zooms in on the plot or plots.

band plota plot that draws a horizontal band using two Y values for each X value, or that drawsa vertical band using two X values for each Y value. A band plot is typically used toshow confidence, error, prediction, or control limits. The points on the upper and lowerband boundaries can be joined to create two outlines, or the area between the boundariescan be filled.

binned datadata that has been summarized or transformed in some way to facilitate its renderingby a parameterized plot. Continuous numeric data is typically binned by setting a binwidth (interval size) and then computing the number of bins, or by setting the numberof bins and computing the bin width. A histogram is often used to represent binneddata.

binsnumeric intervals into which continuous numeric data can be categorized.

block plota plot that displays one or more rectangles (blocks) along an axis, where each rectangleidentifies a block of consecutive observations having the same value for a specifiedblock variable. The first block begins at the start of the axis (mapped to the values ofa specified variable), and represents the first observation s block value, and continuesthrough consecutive observations having the same block value. A change in the blockvariable s value ends the first block and starts the second, which continues throughconsecutive observations until the block value changes again. The last block extendsto the end of the axis.

borderthe outermost outline of a graph, a layout container, or a graphical element (for example,a legend or text).

category variablea classification variable with a finite number of distinct (discrete) values. Thesevariables are typically used to split data into subsets. For example, in a bar chart, eachunique value is displayed as a bar on a DISCRETE axis.

cellin ODS graphics, a distinct rectangular subregion of a graph that can contain plots, text,or legends. For example, a graph defined with the OVERLAY layout contains only onecell, whereas a graph defined with the GRIDDED layout can contain several cells.

582 Glossary

Page 593: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

cell blocka block beginning with a CELL statement and ending with an ENDCELL statementthat defines the graphical content of a cell. The cell block is available only within aLATTICE layout.

cell headera graphical element (typically text or a legend) that is aligned at the top of a cell andprovides information about the cell contents. A cell header is defined within a cell block,which is available only within a LATTICE layout.

child blocka block that is contained within another block when two or more blocks are nested. Forexample, a CELLHEADER block is always a child of a CELL block.

classification levelfor a single classification variable, each unique value is regarded as a classificationlevel. For two or more variables, a classification level is one of the unique combinations(crossings) of the unique values of each variable. For example, if three variables havefour, two, and three distinct values, there are 24 classification levels.

classification panela multi-cell graph created by a layout, such as DATAPANEL, in which the number ofcells is determined by the number of classification levels of one or more classificationvariables. Each cell displays a common plot based on subsets of the input data.

classification variablea variable whose values are used to group (or classify) the observations in a data setinto different groups that are meaningful for analysis. A classification variable can haveeither character or numeric values. Classification variables include group, subgroup,category, and BY variables.

clipto truncate a plot or graphical element (such as a line, marker, or band) when it reachesa boundary such as a plot wall.

columna vertical component of a table. Each column has a unique name, contains data of aspecific type, and has certain attributes. A column is analogous to a variable in SASterminology. In the Graph Template Language a column can also be a set of layoutcells, stacked vertically and sharing the same alignment.

column axisan external axis appearing above or below a column of cells and serving as a commonreference for the column of a multi-cell layout, such as a LATTICE, DATAPANEL,or DATALATTICE layout.

column gutterthe space between columns of cells in a multi-cell layout.

column headertext that labels the column contents in a multi-cell layout. This text can be aligned aboveor below the cells in a column. In a LATTICE layout, the column header is not restrictedto text (it can contain a plot or a legend, for example).

Glossary 583

Page 594: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

column major orderan order for populating cells of a layout or entries in a legend when the number of rowsis specified. By default, cells or entries are filled starting from the top left and movingdown. When the bottom row of the first column is filled, a new column begins fillingto the right of the previous column, and so on until all content items have been placedin cells or entries. There might be empty cells or entries in the last column.

column weightin a LATTICE layout, the proportion of width allotted to a specific column of the layout.The sum of all column weights is 1.

computed plota plot in which input data is internally summarized or otherwise transformed to createnew data that is actually rendered by the plot. Examples of computed plot statementsare BARCHART, BOXPLOT, HISTOGRAM, ELLIPSE, and REGRESSIONPLOT.

conditional logicsyntax that enables one set of statements or an optional alternate set of statements toexecute at run time. In the Graph Template Language, an IF/ENDIF block definesconditional logic: IF (condition) statements; ELSE statements; ENDIF; The ELSEstatement is not required.

continuous legenda legend that shows a mapping between a color ramp or color segments andcorresponding numeric values. Plots that support a COLORMODEL= option can usethis type of legend.

crossinga combination of the unique values of one or more classification variables. See alsoclassification level.

cubein three-dimensional graphics, the outlines formed by the intersection of three pairs ofparallel planes; each pair is orthogonal to the primary X, Y, and Z axes. The display ofthe cube is optional.

data objecta transient version of a SAS data set created by ODS. When an input SAS data set isbound to a compiled graph template, an ODS data object is created, based on all thecolumns requested in the template definition and any new columns that have beendirectly or indirectly computed. A data object can persist when used with the ODSOUTPUT statement.

data tipdata or other detailed information that is displayed when a user positions a mousepointer over an element in a graph. For example, a data tip typically displays the datavalue that is represented by a bar, a plot point, or some other element.

define blockin the TEMPLATE procedure, a define block (beginning with a DEFINE statement andending with an END statement) creates various types of templates, includingSTATGRAPH, STYLE, and TABLE.

dependent plota plot that cannot be rendered by itself. Dependent plots must be overlaid with a stand-alone plot. Dependent plots do not provide data ranges to establish axes.

584 Glossary

Page 595: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

REFERENCELINE, DROPLINE, and LINEPARM statements produce dependentplots. See also stand-alone plot.

dependent variablea variable that is observed to change in response to the independent variables. In afunction y=f(x), the value of the dependent variable y is a function of the independentvariable x.

design sizethe intended size of a graph that is specified in the graph template definition. TheDESIGNHEIGHT and DESIGNWIDTH options of the BEGINGRAPH statement setthe intended height and width, which are used to determine the scale factors when thegraph is resized. The intended height and width are used unless overridden by the ODSGraphics statement HEIGHT or WIDTH options when the template is executed.

device-based graphica graph created with traditional SAS/GRAPH software that requires DEVICEspecification. ODS graphics (template-based graphics) do not use device technology.

discrete axisan axis for categorical data values. The distance between ticks has no significance. Abar chart always has a discrete axis.

discrete legenda legend that provides values or descriptive information about graphical elements in agrouped or overlaid plot.

dots per incha measure of the graph resolution by its dot density. Short form: DPI.

DPISee dots per inch.

drop linea line drawn from a point in the plot area perpendicular to an axis.

dynamic variablea variable defined in a template with the DYNAMIC statement that can be initializedat template run time.

equated axesin two-dimensional plots, axes that use the same drawing scale (ratio of display distanceto data interval) on both axes. For example, an interval of 2 on the X axis maps to thesame display distance as an interval of 2 on the Y axis. The aspect ratio of the plotdisplay equals the aspect ratio of the plot data. In other words, a 45-degree slope in datawill be represented by a 45-degree slope in the display. Equated axes are always ofTYPE=LINEAR. The number of intervals displayed on each axis does not have to bethe same.

external axisan axis that is outside all cells of a layout. An external axis represents a common scalefor all plots in a row or column of a multi-cell layout.

Glossary 585

Page 596: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

fillto apply a color within a bounded area. Many plots, such bar charts and band plots,have bounded areas that can be filled or unfilled. When filled, a color is applied. Whenunfilled, the areas are transparent.

fit policyone of several algorithms for avoiding tick-value collision when space allotted to apredefined area does not permit all the text to fit. For example, an axis might have aTHIN policy that eliminates the display of tick values for alternate ticks. A ROTATEpolicy would turn the tick values at a 45-degree angle. A TRUNCATE policy wouldtruncate all long tick values to a fixed length and add an ellipsis (. . .) at the end to implytruncation. A STAGGER policy would create two rows of tick values with consecutivetick values alternating between rows. A compound policy such as STAGGERROTATEcould be used to automatically choose the best fit policy for the situation.

footnote areathe region below the graph area where text produced by ENTRYFOOTNOTEstatements appears.

frequency variablein an input data set, a non-negative and non-zero integer variable that represents thefrequency of occurrence of the current observation, essentially treating the data set asif each observation appeared <userSuppliedValue>n</userSuppliedValue> times,where <userSuppliedValue>n</userSuppliedValue> is the value of the FREQ variablefor the observation.

fringe plota plot consisting of short, equal-length line segments drawn from and perpendicular toan axis. Each observation of a numeric variable corresponds to the location for a linesegment.

glypha letter, character, punctuation mark, pictogram, or symbol that is rendered in thecontext of some written language. A typeface (font) consists of a coordinated set ofglyphs. See also Unicode.

grapha visualization created by SAS/GRAPH software. A graph that is created by the ODSGraphics system can contain titles, footnotes, legends, and one or more cells, and istypically saved as an image or an SGE file. A generic term for final graphical outputwithout regard to content or format.

graph(ical) areathe region where the visualization displays between the title area and footnote area. Thegraphical area consists of one or more cells. See also title area and footnote area.

graph(ics) templateSee ODS Graphics template.

gridrows and columns of a multi-cell layout.

gridded datainput that contains at least three numeric variables. Two of the variables are treated asX and Y variables and the third variable Z is treated as if it were a function of X andY. The X and Y variable values occur at uniformly spaced intervals (although the size

586 Glossary

Page 597: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

and number of intervals might be different for X and Y). All X,Y pairs are unique, andZ values are interpolated so that every X,Y pair has a Z value. Raw data that has at leastthree numeric variables can be converted to gridded data with the G3GRID procedure(in SAS/GRAPH). The procedure offers both bivariate and spline interpolation methodsfor computing Z values.

group indexa numeric variable with positive integer values that correspond to values of a groupvariable. The index values are used to associate GraphData1GraphData<userSuppliedValue>N</userSuppliedValue> style elements with groupvalues.

group variablea variable in the input data set used to categorize chart variable values into groups. Agroup variable enables the data for each distinct group value to be rendered in a visuallydifferent manner. For example, a grouped scatter plot displays a distinct marker andcolor for each group value.

gutterthe space between columns or rows of cells in a multi-cell layout.

image formata file format that displays a graphical representation. PNG, GIF, TIFF, and JPEG areexamples of image formats, each with different characteristics.

image mapin an HTML file, the information contained in the map tag. This information can beused by a browser to display data tips on the image.

independent variablea variable that persists and affects dependent variables. For a function y=f(x), the valueof the dependent variable y is a function of the independent variable x. For example ina REGRESSIONPLOT statement, the X= variable is the independent variable.

inseta graphical element such as a legend, line of text, or a table of text that is embeddedinside of a graph's plot area.

interval axisan axis where the distance between tick marks represents monotonically increasing ordecreasing numeric units of some scale (like a ruler). The standard interval axis is calleda LINEAR axis. Specialized interval axes include a TIME axis and a LOG axis.

layouta generic term for a rectangular container that lays out the positions and sizes of itschild components.

layout blocka block beginning with a LAYOUT statement and ending with an ENDLAYOUTstatement.

layout grida multi-cell layout arranged as a grid of cells in rows and columns.

Glossary 587

Page 598: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

layout typea keyword indicating the functionality of the layout. For example OVERLAY,LATTICE, and DATAPANEL are layout types.

legend entrya combination of a graphical element such as a marker or line along with text describingthe value or use of the graphical element. A discrete legend can have several legendentries.

legend titletext that explains how to interpret the legend.

line propertya value that defines the pattern, thickness, or color of a line. By default, the value fora line property is derived from a style element in the current style.

linear axisan interval axis with ticks placed on a linear scale.

loess plota curved line showing a loess fit for a set of points.

log axisan interval axis with ticks placed on a log scale with a base of 10, 2, or e. A log axiscan show ticks 1) that are uniformly spaced representing integer powers of the base, 2)that are uniformly spaced representing the expanded integer powers of the base, or 3)that are uniformly spaced in the data domain (100, 200, 300), but may be shown in anon-uniform spacing on the axis.

macro variable referencein a template definition, a reference to a macro variable that has been declared withMVAR or NMVAR statements. These references are meant to be resolved at templaterun time and should not be preceded with an ampersand. If a standard macro variablereference (a name preceded with an ampersand) appears in a template definition, it isresolved at template compile time.

markera symbol such as a dot, a cross, a diamond, a circle, or a triangle that is used to indicatethe location of, or annotate, a data point in a plot or graph.

marker propertya value that defines the symbol used as a marker, or its size, weight, or color. By default,the value for a marker property is derived from a style element in the current style.

multi-cell layouta layout that supports a rectangular grid of cells, each of which can contain a graphicalelement, such as a plot, a legend, a nested layout, and so on.

nested layouta layout block that appears within the scope of another layout block.

ODSSee Output Delivery System.

588 Glossary

Page 599: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ODS Graphicsan extension to ODS that is used to create analytical graphs using the Graph TemplateLanguage.

ODS Graphics Editoran interactive application that can be used to edit and annotate ODS Graphics output.

ODS Templatea description of how output should appear when it is formatted. ODS templates arestored as compiled entries in a template store (item store). Common template typesinclude STATGRAPH, STYLE, CROSSTABS, TAGSET, and TABLE.

opaquea property of a background. Opaque backgrounds are filled with a color. Non-opaquebackgrounds are transparent.

outliera data point that differs from the general trend of the data by more than is expected bychance alone. An outlier might be an erroneous data point or one that is not from thesame sampling model as the rest of the data.

Output Delivery Systema component of SAS software that can produce output in a variety of formats such asmarkup languages (HTML, XML), PDF, listing, RTF, PostScript, and SAS data sets.Short form: ODS.

overlaya plot that can be superimposed on another plot when specified within an overlay-typelayout. A common overlay combination is a fit line on a scatter plot.

overlay layouta type of layout that supports the superimposition of graphical components, such asplots, legends, and nested layouts.

paddingspace added inside the border of a graphical component, such as a layout or a legend.

panela graph with multiple cells.

parameterized plota non-computed plot that requires parameterized data. The Graph Template Languageoffers several plots in both computed and parameterized versions, for example,BARCHART and BARCHARTPARM. Some computed plots such asREGRESSIONPLOT can be emulated with a SERIESPLOT if the input datarepresented points on a fit line.

parent blockwhen two or more blocks are nested, any layout block that contains one or more layoutblocks is a parent of the contained blocks.

plota visual representation of data such as a scatter plot, a series line, or a histogram. In theODS Graphics context, plot is a generic term for the graphical element or elementsdrawn by a plot statement. Multiple plots can be overlaid in a cell to create a graph.

Glossary 589

Page 600: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

plot areathe space, bounded by the axes, where a visual representation of data, such as a scatterplot, a series line, or a histogram, is drawn.

plot typea plot family such as bar chart (which would include horizontal, vertical, and groupedbar charts), or a classification scheme for plots based on some useful criteria, such aswhether the plots are computed or parameterized.

primary axisthe X or Y axis contrasted to the X2 or Y2 secondary axis.

primary plotthe plot in an overlay that determines axis features, such as axis type and axis label.

prototype layoutan overlay plot composite that appears in each cell of a classification panel. Eachinstance of the prototype represents a different subset (classification level) of the data.

regression plota straight or curved line showing a linear or higher order regression fit for a set of points.

required argumenta variable or constant that must be specified in order to evaluate an expression or rendera plot, legend, text, or a layout. For example, a scatter plot has two required arguments:X=column and Y=column.

response variableSee dependent variable.

rich texta generic term for text that can have different font characteristics (color, family, size,weight, style) on a character-by-character basis and can also be used as a superscriptor subscript. All text statements in GTL support rich text.

rolea description of the purpose that a variable serves in a plot. For example, a series plothas predefined roles named for X , Y, GROUP, and CURVELABEL.

rowa set of layout cells that are side-by-side and share the same alignment.

row axisan external axis appearing on the left or right of a row of cells in a multi-cell layout.

row gutterspace between rows of cells of a multi-cell layout.

row headertypically, the text that identifies the row contents in a multi-cell layout. This text canbe aligned to the right or left of the cells in a row. The row header is not restricted totext (it can contain a plot or a legend, for example).

row major orderan order for populating cells of a layout or entries of a legend when the number ofcolumns is specified. For example, in the default case: Start at the top left and fill cells

590 Glossary

Page 601: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

or entries left-to-right. When the right-most column is filled, begin a new row belowthe previous row. Continue this until all content items have been placed in cells orentries. There might be empty cells/entries in the last row.

row weightin a LATTICE layout, the proportion of height allotted to a specific row of the layout.The sum of all row weights is 1.

secondary axisthe X2 or Y2 axis as contrasted to the X or Y primary axis.

SGE filea file created in the ODS Graphics environment that contains an editable graph. Suchfiles have a .SGE file extension and can be edited only with the ODS Graphics Editor.You can edit SGE files from the SAS Results window or by opening the SGE file fromwithin the ODS Graphics editor.

sidebaran area of certain multi-cell layouts external to the grid of cells where text or othergraphical elements can appear. The LATTICE, DATAPANEL, and DATALATTICElayout support four sidebar areas (TOP, BOTTOM, LEFT, and RIGHT).

single-cell layouta layout type that supports only one cell. The OVERLAY, OVERLAY3D, andOVERLAYEQUATED layouts are examples of single-cell layouts.

sparse datain classification panels with two or more classifiers, some crossings of the classificationvalues might not be present in the input data. Such input data is called sparse data. Bydefault, a DATAPANEL layout does not generate cells for sparse data, but if requested,it can produce empty cells as place holders for the non-existent crossings.

stand-alone plota plot that has its own data range and can therefore appear by itself in a layout.

statement blocka group of statements that has both a logical beginning and ending statement. Forexample, a LAYOUT statement along with its ENDLAYOUT statement and allcontained statements are a block. Some blocks can be nested within other blocks.

stylean ODS template that can be used to control the visual aspects (colors, fonts, lines,markers, and so on) of a graph. A style consists of many style elements, and each styleelement consists of style attributes.

style attributea visual property such as a color, line pattern, or font property that has a reserved name.For example, COLOR, FONTFAMILY, FONTSIZE, FONTWEIGHT, andFONTSTYLE are all attributes of style elements such as GraphTitleText,GraphLabelText, and so on. Style attributes are collectively referenced by a styleelement within a style definition.

style elementa named collection of style attributes that affects specific parts of ODS output. Forexample, the GraphTitleText style element specifies the color and font properties oftitle text and possibly other text in the graph.

Glossary 591

Page 602: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

style referencea part of the Graph Template Language syntax that indicates the current value of aspecific attribute of a specific style element. For example,SIZE=GraphTitleText:FontSize means to assign to SIZE the value of the FontSizeattribute of the GraphTitleText style element from the current style.

surface plota three-dimensional graph that displays values of a vertical Z variable based on griddedX and Y variables.

template compile timethe phase when the source program of a template definition is submitted. The syntaxof the definition is evaluated for correctness. If no errors are detected, the definition isconverted to a binary format and stored for later access.

template definitionthe TEMPLATE procedure source program that creates a template. A templatedefinition can be generated from a compiled template. Also called the template source.

template run timethe actions performed when a compiled template is bound to a data object and thenrendered to produce a graph. Run-time errors can occur that prevent a graph from beingproduced.

template sourceSee template definition.

template storean item store that contains definitions that were created by the TEMPLATE procedure.Definitions that SAS provides are in the item store Sashelp.Tmplmst. You can storedefinitions that you create in any template store to which you have write access.

template-based graphicSAS/GRAPH output where a compiled ODS template of the type STATGRAPH isused to produce graphical output, that is, a graph produced within the ODS graphicsenvironment as opposed to a graph produced in the traditional device-basedenvironment.

text propertiesa common set of characteristics that can be specified for any text string: COLOR,FAMILY, SIZE, WEIGHT, and STYLE. By default, values for these properties arederived from a style element in the current style.

time axisan axis type that displays only SAS date, time, or datetime values. Axis tick valueincrements can be specified as time or date intervals, such as MINUTE, HOUR, DAY,WEEK, MONTH, QUARTER, or YEAR.

title areathe region above the graph area where text produced by ENTRYTITLE statementsappears.

transparencythe degree to which a graphic element (such as a marker or filled area) is opaque ortransparent. Transparency is indicated with a number from 0 (completely opaque) to 1(completely transparent).

592 Glossary

Page 603: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Unicodean encoding system that provides a single comprehensive mapping of all characters(glyphs) in all languages to unique numeric values called code points.

viewportSee axis viewport.

wallthe area bounded by orthogonal axis pairs. In two-dimensional graphs, there is one wallbounded by the XY axes. In three-dimensional graphs, there are three walls, boundedby the XY, YZ, and XZ axes. A wall has an optional outline and can be opaque ortransparent.

weight variablea positive numeric variable in the input data set that represents a weight to be appliedto the current observation.

Glossary 593

Page 604: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

594 Glossary

Page 605: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Index

AACROSS= option

DISCRETELEGEND statement 502ALIGN=

SIDEBAR statement, datalattice layout37

SIDEBAR statement, datapanel layout52

SIDEBAR statement, lattice layout 82ALPHA= option

ELLIPSE statement 232ALPHA= regression option

LOESSPLOT statement 277PBSPLINEPLOT statement 301REGRESSIONPLOT statement 317

ALTDISPLAY= optiondatalattice, datapanel axis options 471

ALTDISPLAYSECONDARY= optiondatalattice, datapanel axis options 471

ALTFILLATTRS= optionBLOCKPLOT statement 174

anatomy of a graph 7area fill

remapping in grouped data 121arrow value type 559ARROWDIRECTION= option

VECTORPLOT statement 387ARROWHEADS= option

VECTORPLOT statement 387ARROWHEADSHAPE= option

VECTORPLOT statement 387ASORT function 550AUTOALIGN= option

CONTINUOUSLEGEND statement495

DISCRETELEGEND statement 503ENTRY statement 520LAYOUT GRIDDED statement 68LAYOUT LATTICE statement 84

axis, defined 7axis features

axis types 400controlling 400data mapping 396displayed axis features 395in data lattice layouts 399in data panel layouts 399in gridded layouts 400in lattice-type layouts 399in layouts 395in overlay-type layouts 398OFFSETMAX= 403OFFSETMIN= 403overview 10, 395setting axis types 401THRESHOLDMAX= 402THRESHOLDMIN= 402VIEWMAX= 402VIEWMIN= 402when plots share data 397

axis optionsLAYOUT DATALATTICE statement

467LAYOUT DATAPANEL statement 467LAYOUT LATTICE statement 437LAYOUT OVERLAY statement 405LAYOUT OVERLAY3D statement 425LAYOUT OVERLAYEQUATED

statement 455axis statements in LATTICE layout

COLUMN2HEADERS statement 81COLUMNHEADERS statement 81ROW2HEADERS statement 81ROWHEADERS statement 81

BBACKGROUNDCOLOR= option

BEGINGRAPH statement 24CONTINUOUSLEGEND statement

495DISCRETELEGEND statement 503

595

Page 606: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ENTRY statement 521ENTRYFOOTNOTE statement 529ENTRYTITLE statement 537LAYOUT DATALATTICE statement

39LAYOUT DATAPANEL statement 54LAYOUT GRIDDED statement 68LAYOUT LATTICE statement 85LAYOUT OVERLAY statement 92LAYOUT OVERLAY3D statement 105LAYOUT OVERLAYEQUATED

statement 98BANDPLOT statement 127BARCHART statement 139BARCHARTPARM statement 151BARLABEL= option

BARCHART statement 142BARLABELATTRS= option

BARCHART statement 142BARLABELFORMAT= option

BARCHART statement 142BARWIDTH= option

BARCHART statement 143BARCHARTPARM statement 154

BASE=LOGOPTS= option, datalattice or

datapanel axis 482LOGOPTS= option, lattice axis 449LOGOPTS= option, overlay axis 418

BASELINEINTERCEPT= optionNEEDLEPLOT statement 294

BEGINGRAPH statement 4, 21BIHISTOGRAM3DPARM statement 163BINAXIS= option

BIHISTOGRAM3DPARM statement166

HISTOGRAM statement 254HISTOGRAMPARM statement 262

BINSTART= optionHISTOGRAM statement 254

BINWIDTH= optionHISTOGRAM statement 254

BLOCK= argumentBLOCKPLOT statement 172

BLOCKINDEX= optionBLOCKPLOT statement 174

BLOCKPLOT statement 169boolean value type 559border, specifying on a graph 16BORDER= option

BEGINGRAPH statement 24CONTINUOUSLEGEND statement

495DISCRETELEGEND statement 503ENTRY statement 521ENTRYFOOTNOTE statement 529

ENTRYTITLE statement 537LAYOUT DATALATTICE statement

39LAYOUT DATAPANEL statement 54LAYOUT GRIDDED statement 69LAYOUT LATTICE statement 85LAYOUT OVERLAY statement 92LAYOUT OVERLAY3D statement 106LAYOUT OVERLAYEQUATED

statement 98BORDER= option, ODS GRAPHICS

statement 16BORDERATTRS= option

BEGINGRAPH statement 24CONTINUOUSLEGEND statement

496DISCRETELEGEND statement 503ENTRY statement 521ENTRYFOOTNOTE statement 529ENTRYTITLE statement 537LAYOUT DATALATTICE statement

39LAYOUT DATAPANEL statement 54LAYOUT GRIDDED statement 69LAYOUT LATTICE statement 85LAYOUT OVERLAY statement 92LAYOUT OVERLAY3D statement 106LAYOUT OVERLAYEQUATED

statement 98BOUNDARY= option

HISTOGRAM statement 255BOXPLOT statement 179BOXPLOTPARM statement 191BOXWIDTH= option

BOXPLOT statement 183BOXPLOTPARM statement 198

BREAK= optionSERIESPLOT statement 354STEPPLOT statement 366

CCAPSHAPE= option

BOXPLOT statement 183BOXPLOTPARM statement 198

cell, defined 7CELL block

in LAYOUT LATTICE 77CELLHEADER statement

in LAYOUT LATTICE 78CELLHEIGHTMIN= option

LAYOUT DATALATTICE statement39

LAYOUT DATAPANEL statement 54CELLWIDTHMIN= option

596 Index

Page 607: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

LAYOUT DATALATTICE statement40

LAYOUT DATAPANEL statement 55CLASS= option

BLOCKPLOT statement 174CLASSVARS= argument

LAYOUT DATAPANEL statement 51CLI= regression option

PBSPLINEPLOT statement 301REGRESSIONPLOT statement 317

CLIP= optionDROPLINE statement 226ELLIPSE statement 233ELLIPSEPARM statement 242LINEPARM statement 271REFERENCELINE statement 312VECTORPLOT statement 387

CLM= regression optionLOESSPLOT statement 277PBSPLINEPLOT statement 301REGRESSIONPLOT statement 317

COLLABEL function 550COLNAME function 549color value type 560COLOR= attribute

for fills 564for lines 564for markers 565for text 566

COLORMODEL= optionCONTOURPLOTPARM statement 208SCATTERPLOT statement 326SCATTERPLOTMATRIX statement

339SURFACEPLOTPARM statement 379

colorsremapping in grouped data 121with grouped data 119with non-grouped data 117

column value type 560COLUMN2HEADERS statement

LAYOUT LATTICE statement 81COLUMNAXES block

in LAYOUT LATTICE 80COLUMNAXIS statement

in LAYOUT LATTICE 80LAYOUT LATTICE statement 437

COLUMNAXISOPTS= optionLAYOUT DATALATTICE statement

40, 467LAYOUT DATAPANEL statement 55,

467COLUMNDATARANGE= option

LAYOUT DATALATTICE statement40

LAYOUT DATAPANEL statement 55

LAYOUT LATTICE statement 80, 85COLUMNGUTTER= option

LAYOUT DATALATTICE statement40

LAYOUT DATAPANEL statement 55LAYOUT GRIDDED statement 69LAYOUT LATTICE statement 85

COLUMNHEADERS statementLAYOUT LATTICE statement 81

COLUMNHEADERS= optionLAYOUT DATALATTICE statement

40COLUMNS= option

LAYOUT DATALATTICE statement41

LAYOUT DATAPANEL statement 55LAYOUT GRIDDED statement 69LAYOUT LATTICE statement 86

COLUMNVAR= argumentLAYOUT DATALATTICE statement

36COLUMNWEIGHTS= option

LAYOUT LATTICE statement 86COMMONAXISOPTS= option

LAYOUT OVERLAYEQUATEDstatement 99, 455, 456

computed plots 10conditional logic

example uses 553IF statement 14, 553overview 14why used 554

CONNECT= optionBOXPLOT statement 183BOXPLOTPARM statement 199

CONNECTATTRS= optionBARCHART statement 143BARCHARTPARM statement 155BOXPLOT statement 184BOXPLOTPARM statement 199

CONNECTORDER= optionBANDPLOT statement 131SERIESPLOT statement 354STEPPLOT statement 366

CONTINUOUSLEGEND statement 491CONTOURPLOTPARM statement 205CONTOURTYPE= option

CONTOURPLOTPARM statement 208CORROPTS= option

SCATTERPLOTMATRIX statement339

CSS function 551CUBE= option

LAYOUT OVERLAY3D statement 106curve labels

location and position in templates 123

Index 597

Page 608: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

location relative to plot area 123position relative to curve line 124

CURVELABEL= optionDENSITYPLOT statement 218LINEPARM statement 271LOESSPLOT statement 279PBSPLINEPLOT statement 303REFERENCELINE statement 312REGRESSIONPLOT statement 319SERIESPLOT statement 354STEPPLOT statement 366

CURVELABELATTRS= optionBANDPLOT statement 131DENSITYPLOT statement 218LINEPARM statement 271LOESSPLOT statement 279MODELBAND statement 286PBSPLINEPLOT statement 303REFERENCELINE statement 312REGRESSIONPLOT statement 319SERIESPLOT statement 355STEPPLOT statement 366

CURVELABELLOCATION= optionBANDPLOT statement 132DENSITYPLOT statement 218LINEPARM statement 271LOESSPLOT statement 279MODELBAND statement 286PBSPLINEPLOT statement 303REFERENCELINE statement 313REGRESSIONPLOT statement 319SERIESPLOT statement 355STEPPLOT statement 366

CURVELABELLOWER= optionBANDPLOT statement 131MODELBAND statement 286

CURVELABELPOSITION= optionBANDPLOT statement 132DENSITYPLOT statement 219LINEPARM statement 272LOESSPLOT statement 279MODELBAND statement 287PBSPLINEPLOT statement 304REFERENCELINE statement 313REGRESSIONPLOT statement 320SERIESPLOT statement 355STEPPLOT statement 367

CURVELABELUPPER= optionBANDPLOT statement 131MODELBAND statement 286

CV function 551CYCLEATTRS= option

LAYOUT OVERLAY statement 92LAYOUT OVERLAY3D statement 106LAYOUT OVERLAYEQUATED

statement 99

LAYOUT PROTOTYPE statement 110

DDATALABEL= option

BOXPLOT statement 184BOXPLOTPARM statement 199NEEDLEPLOT statement 294SCATTERPLOT statement 327SCATTERPLOTMATRIX statement

340SERIESPLOT statement 356STEPPLOT statement 367VECTORPLOT statement 387

DATALABELATTRS= optionBOXPLOT statement 184BOXPLOTPARM statement 199NEEDLEPLOT statement 294SCATTERPLOT statement 327SCATTERPLOTMATRIX statement

340SERIESPLOT statement 356STEPPLOT statement 368VECTORPLOT statement 388

DATALATTICE layout 31, 33DATAPANEL layout 31, 49DATATRANSPARENCY= option

BANDPLOT statement 132BARCHART statement 143BARCHARTPARM statement 155BIHISTOGRAM3DPARM statement

166BLOCKPLOT statement 174BOXPLOT statement 184BOXPLOTPARM statement 199DENSITYPLOT statement 219DROPLINE statement 226ELLIPSE statement 233ELLIPSEPARM statement 242FRINGEPLOT statement 247HISTOGRAM statement 255HISTOGRAMPARM statement 262LINEPARM statement 272LOESSPLOT statement 280MODELBAND statement 287NEEDLEPLOT statement 294PBSPLINEPLOT statement 304REFERENCELINE statement 313REGRESSIONPLOT statement 320SCATTERPLOT statement 327SCATTERPLOTMATRIX statement

340SERIESPLOT statement 356STEPPLOT statement 368SURFACEPLOTPARM statement 380VECTORPLOT statement 388

598 Index

Page 609: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DEFINE STATGRAPH statement 4DEGREE= regression option

LOESSPLOT statement 277PBSPLINEPLOT statement 301REGRESSIONPLOT statement 317

DENSITYPLOT statement 213DESIGNHEIGHT= option

BEGINGRAPH statement 24BEGINGRAPH statement with

datalattice layout 36BEGINGRAPH statement with

datapanel layout 51DESIGNWIDTH= option

BEGINGRAPH statement 25BEGINGRAPH statement with

datalattice layout 36BEGINGRAPH statement with

datapanel layout 51DIAGONAL= option

SCATTERPLOTMATRIX statement341

dimension value type 561DISCRETELEGEND statement 499DISCRETEOFFSET= option

BARCHART statement 143BARCHARTPARM statement 155BOXPLOT statement 184BOXPLOTPARM statement 200DROPLINE statement 226REFERENCELINE statement 313SCATTERPLOT statement 327SERIESPLOT statement 356STEPPLOT statement 368

DISCRETEOPTS= optiondatalattice, datapanel axis options 477lattice axis options 443overlay axis options 412

display attributesavailable line patterns 566cycling through group attributes 121grouped data 119overview 117specifying fill color 564specifying line attributes 117specifying line color 564specifying line pattern 565specifying line thickness 565specifying marker attributes 118specifying marker color 565specifying marker size 565specifying marker symbol 565specifying marker weight 566specifying text color 566specifying text font family 566specifying text size 566specifying text style 566

specifying text weight 566DISPLAY=

XAXISOPTS=, YAXISOPTS= options,overlayequated axis 460

DISPLAY= optionand attribute options 122BANDPLOT statement 133BARCHART statement 145BARCHARTPARM statement 157BIHISTOGRAM3DPARM statement

166BLOCKPLOT statement 174BOXPLOT statement 185BOXPLOTPARM statement 201datalattice, datapanel axis options 472ELLIPSE statement 233ELLIPSEPARM statement 242HISTOGRAM statement 255HISTOGRAMPARM statement 262lattice axis options 439MODELBAND statement 287NEEDLEPLOT statement 294overlay axis options 407overlay3d axis options 427SERIESPLOT statement 357STEPPLOT statement 368

DISPLAYCLIPPED= optionDISCRETELEGEND statement 503

DISPLAYSECONDARY=XAXISOPTS=, YAXISOPTS= options,

overlayequated axis 461DISPLAYSECONDARY= option

datalattice, datapanel axis options 473lattice axis options 440overlay axis options 408

DOWN= optionDISCRETELEGEND statement 504

DROPLINE statement 223DROPTO= option

DROPLINE statement 227DSORT function 550DYNAMIC statement

TEMPLATE procedure 13, 543dynamic variables

See also dynamicscompared to macro variables 544

dynamicsoverview 13using on templates 543

EELLIPSE = option

SCATTERPLOTMATRIX statement341

ELLIPSE statement 229

Index 599

Page 610: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

ELLIPSEPARM statement 237ENDLABELS= option

BIHISTOGRAM3DPARM statement166

HISTOGRAM statement 255HISTOGRAMPARM statement 263

ENTRY statement 517greek letters 514prefix options 510reserved keywords 514text commands 512Unicode values 514

ENTRYFOOTNOTE statement 525greek letters 514prefix options 510reserved keywords 514text commands 512Unicode values 514

ENTRYTITLE statement 533greek letters 514prefix options 510reserved keywords 514text commands 512Unicode values 514

EQUATETYPE= optionLAYOUT OVERLAYEQUATED

statement 99ERRORBARATTRS= option

BARCHARTPARM statement 157SCATTERPLOT statement 328STEPPLOT statement 369

ERRORLOWER= optionBARCHARTPARM statement 157STEPPLOT statement 369

ERRORUPPER= optionBARCHARTPARM statement 158STEPPLOT statement 369

EVAL construct 12with expressions 545with functions 549

EXISTS function 550EXPAND function 550expression value type 561expressions

and data filtering 546and data subsetting 546and type conversion 546difference from WHERE expressions

546example uses 545on plot statement arguments 546overview 12similarity to WHERE expressions 546why used 545

EXTEND= optionBANDPLOT statement 133

LINEPARM statement 272EXTREME= option

BOXPLOT statement 186BOXPLOTPARM statement 202

FFAMILY= attribute

for text 566fill attributes

remapping in grouped data 121specifying fill color 564

FILLATTRS= optionBANDPLOT statement 133BARCHART statement 145BARCHARTPARM statement 158BIHISTOGRAM3DPARM statement

167BLOCKPLOT statement 175BOXPLOT statement 187BOXPLOTPARM statement 202ELLIPSE statement 233ELLIPSEPARM statement 242HISTOGRAM statement 255HISTOGRAMPARM statement 263MODELBAND statement 288SURFACEPLOTPARM statement 380

FILLTYPE= optionBLOCKPLOT statement 175

flexible templates, overview 12fonts

See text attributesfootnote area, defined 7format value type 561formats

See SAS formatsFREQ= option

BOXPLOT statement 187DENSITYPLOT statement 219ELLIPSE statement 233HISTOGRAM statement 255SCATTERPLOT statement 329SCATTERPLOTMATRIX statement

342FREQ= regression option

PBSPLINEPLOT statement 301REGRESSIONPLOT statement 318

FRINGEHEIGHT= optionFRINGEPLOT statement 247

FRINGEPLOT statement 245functions

ASORT 550COLLABEL 550COLNAME 549CSS 551CV 551

600 Index

Page 611: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

DSORT 550example uses 550EXISTS 550EXPAND 550GTL only functions 549KURTOSIS 551LCLM 551MAX 551MEAN 551MEDIAN 551MIN 551N 551NMISS 551NUMERATE 550overview 12P1 551P25 551P5 551P50 551P75 551P90 551P95 551P99 551PROBT 551Q1 551Q3 551QRANGE 551RANGE 551SKEWNESS 552STDDEV 552STDERR 552SUM 552summary statistics functions 550SUMWGT 552T 552types available 549UCLM 552USS 552VAR 552

Ggraph, defined 7graph template language

See templatesgraphics environment

ODS GRAPHICS statement 116greek letters 514GRIDATTRS=

XAXISOPTS=, YAXISOPTS= options,overlayequated axis 461

GRIDATTRS= optiondatalattice, datapanel axis options 473lattice axis options 440overlay axis options 408overlay3d axis options 427

GRIDDED layout 30, 65GRIDDED= option

CONTOURPLOTPARM statement 209GRIDDISPLAY=

XAXISOPTS=, YAXISOPTS= options,overlayequated axis 461

GRIDDISPLAY= optiondatalattice, datapanel axis options 473lattice axis options 440overlay axis options 408overlay3d axis options 427

GROUP= optionBANDPLOT statement 133BARCHART statement 146BARCHARTPARM statement 158ELLIPSEPARM statement 243LINEPARM statement 272LOESSPLOT statement 280NEEDLEPLOT statement 295PBSPLINEPLOT statement 304REGRESSIONPLOT statement 320SCATTERPLOT statement 329SCATTERPLOTMATRIX statement

342SERIESPLOT statement 357STEPPLOT statement 369VECTORPLOT statement 388

grouped datacycling through group attributes 121lines, colors, and marker symbols 119remapping colors, fills, markers, lines

121GROUPORDER= option

BARCHART statement 147BARCHARTPARM statement 158

HHALIGN= option

CONTINUOUSLEGEND statement496

DISCRETELEGEND statement 504ENTRY statement 521ENTRYFOOTNOTE statement 529ENTRYTITLE statement 537LAYOUT GRIDDED statement 69LAYOUT LATTICE statement 86

HALIGN= prefix optionENTRY statement 510ENTRYFOOTNOTE statement 510ENTRYTITLE statement 510example uses 510

HEADERBACKGROUNDCOLOR=option

LAYOUT DATALATTICE statement41

Index 601

Page 612: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

LAYOUT DATAPANEL statement 56HEADERLABELATTRS= option

LAYOUT DATALATTICE statement41

LAYOUT DATAPANEL statement 56HEADERLABELDISPLAY= option

LAYOUT DATALATTICE statement41

LAYOUT DATAPANEL statement 56HEADERLABELLOCATION= option

LAYOUT DATALATTICE statement42

HEADEROPAQUE= optionLAYOUT DATALATTICE statement

42LAYOUT DATAPANEL statement 56

height, specifying on a graph 16, 116HEIGHT= option, ODS GRAPHICS

statement 16, 116HISTOGRAM statement 251HISTOGRAMPARM statement 259

IIF statement

conditional logic 553conditional logic on templates 14

imagesimage format 116image name 116image size 116

INDEX= optionBANDPLOT statement 134BARCHART statement 147BARCHARTPARM statement 159ELLIPSEPARM statement 243LINEPARM statement 273LOESSPLOT statement 280NEEDLEPLOT statement 295PBSPLINEPLOT statement 305REGRESSIONPLOT statement 321remapping colors, fills, markers, lines

121SCATTERPLOT statement 329SCATTERPLOTMATRIX statement

342SERIESPLOT statement 357STEPPLOT statement 369VECTORPLOT statement 388

INSET= optionLAYOUT DATALATTICE statement

42LAYOUT DATAPANEL statement 56SCATTERPLOTMATRIX statement

343INSETOPTS= option

LAYOUT DATALATTICE statement42

LAYOUT DATAPANEL statement 57SCATTERPLOTMATRIX statement

343integer value type 561integer-column value type 561INTEGER=

COMMONAXISOPTS= option,overlayequated axis 456

LINEAROPTS= option, datalattice ordatapanel axis 478

LINEAROPTS= option, lattice axis 445LINEAROPTS= option, overlay axis

413LINEAROPTS= option, overlay3d axis

430INTERPOLATION= regression option

LOESSPLOT statement 277INTERVAL=

TIMEOPTS= option, datalattice ordatapanel axis 485

TIMEOPTS= option, lattice axis 451TIMEOPTS= option, overlay axis 420TIMEOPTS= option, overlay3d axis

433

Jjava environment

See memory managementJOIN= option

STEPPLOT statement 370JREOPTIONS option

managing Java memory 579JUSTIFY= option

BANDPLOT statement 134STEPPLOT statement 370

KKERNEL distribution option

DENSITYPLOT statement 216KURTOSIS function 551

LLABEL=

XAXISOPTS=, YAXISOPTS= options,overlayequated axis 462

LABEL= optionBLOCKPLOT statement 175datalattice, datapanel axis options 474DROPLINE statement 227lattice axis options 441overlay axis options 409

602 Index

Page 613: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

overlay3d axis options 428LABELATTRS=

XAXISOPTS=, YAXISOPTS= options,overlayequated axis 462

LABELATTRS= optionBLOCKPLOT statement 176datalattice, datapanel axis options 475DROPLINE statement 227lattice axis options 441overlay axis options 409overlay3d axis options 428

LABELFAR= optionBOXPLOT statement 187BOXPLOTPARM statement 202

LABELPOSITION= optionBLOCKPLOT statement 176

labelslocation and position in templates 123

LATTICE layout 30, 73LAYOUT DATALATTICE statement 31,

33axis options 467

LAYOUT DATAPANEL statement 31,49

axis options 467LAYOUT GRIDDED statement 30, 65LAYOUT LATTICE statement 30, 73

axis options 437LAYOUT OVERLAY statement 29, 89

axis options 405LAYOUT OVERLAY3D statement 30,

103axis options 425

LAYOUT OVERLAYEQUATEDstatement 29, 95

axis options 455LAYOUT PROTOTYPE statement 29,

109with LAYOUT DATALATTICE 37with LAYOUT DATAPANEL 52

layout statementsconditional logic 14, 553multi-cell 8overlay-type 8summary 29

LCLM function 551LEGENDLABEL= option

BANDPLOT statement 134BARCHART statement 147BARCHARTPARM statement 159BIHISTOGRAM3DPARM statement

167BOXPLOT statement 187BOXPLOTPARM statement 203CONTOURPLOTPARM statement 210DENSITYPLOT statement 220

DROPLINE statement 227ELLIPSE statement 234ELLIPSEPARM statement 243FRINGEPLOT statement 248HISTOGRAM statement 256HISTOGRAMPARM statement 263LINEPARM statement 273LOESSPLOT statement 281MODELBAND statement 288NEEDLEPLOT statement 295PBSPLINEPLOT statement 305REFERENCELINE statement 314REGRESSIONPLOT statement 321SCATTERPLOT statement 330SERIESPLOT statement 358STEPPLOT statement 370SURFACEPLOTPARM statement 380VECTORPLOT statement 388

legendsCONTINUOUSLEGEND statement

491defined 8DISCRETELEGEND statement 499overview 11

LIMITLOWER= argumentBANDPLOT statement 129

LIMITUPPER= argumentBANDPLOT statement 129

line attributesavailable line patterns 566specifying line color 564specifying line pattern 117, 565specifying line thickness 565with grouped data 119with non-grouped data 117

line stylesremapping in grouped data 121

line-pattern-name value type 561line-pattern-number value type 561LINEAROPTS= option

datalattice, datapanel axis options 477lattice axis options 444overlay axis options 412overlay3d axis options 430

LINEATTRS= optionCONTOURPLOTPARM statement 210DENSITYPLOT statement 220DROPLINE statement 227FRINGEPLOT statement 248LINEPARM statement 273LOESSPLOT statement 281NEEDLEPLOT statement 296PBSPLINEPLOT statement 305REFERENCELINE statement 314REGRESSIONPLOT statement 321SERIESPLOT statement 358

Index 603

Page 614: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

STEPPLOT statement 370VECTORPLOT statement 389

LINELABELATTRS= optionCONTOURPLOTPARM statement 210

LINELABELBASELINE= optionCONTOURPLOTPARM statement 210

LINELABELFORMAT= optionCONTOURPLOTPARM statement 210

LINELABELPOSITION= optionCONTOURPLOTPARM statement 210

LINEPARM statement 267LOCATION= option

CONTINUOUSLEGEND statement496

DISCRETELEGEND statement 504LAYOUT GRIDDED statement 70

LOESSPLOT statement 275LOGOPTS= option

datalattice, datapanel axis options 482lattice axis options 449overlay axis options 417

Mmacro variables

compared to dynamic variables 544overview 13using on templates 543

marker attributesremapping in grouped data 121specifying in a template 118specifying marker color 565specifying marker size 565specifying marker symbol 565specifying marker weight 566with grouped data 119with non-grouped data 117

marker-name value type 561MARKERATTRS= option

NEEDLEPLOT statement 296SCATTERPLOT statement 330SCATTERPLOTMATRIX statement

345SERIESPLOT statement 358STEPPLOT statement 370

MARKERCHARACTER= optionSCATTERPLOT statement 330SCATTERPLOTMATRIX statement

345MARKERCHARACTERATTRS= option

SCATTERPLOT statement 330SCATTERPLOTMATRIX statement

345MARKERCOLORGRADIENT= option

SCATTERPLOT statement 331

SCATTERPLOTMATRIX statement346

MAX function 551MAXPOINTS= regression option

LOESSPLOT statement 277PBSPLINEPLOT statement 302REGRESSIONPLOT statement 318

MEAN function 551MEANATTRS= option

BOXPLOT statement 187BOXPLOTPARM statement 203

MEDIAN function 551MEDIANATTRS= option

BOXPLOT statement 187BOXPLOTPARM statement 203

memory managementin java environment 579JREOPTIONS option 579

MIN function 551MINORTICKS=

LOGOPTS= option, datalattice ordatapanel axis 482

LOGOPTS= option, lattice axis 449LOGOPTS= option, overlay axis 418TIMEOPTS= option, datalattice or

datapanel axis 486TIMEOPTS= option, lattice axis 452TIMEOPTS= option, overlay axis 421TIMEOPTS= option, overlay3d axis

434MODELBAND statement 283MODELNAME= option

BANDPLOT statement 134multi-cell layouts 8MVAR statement

TEMPLATE procedure 13, 543

NN function 551NAME= option

BANDPLOT statement 135BARCHART statement 147BARCHARTPARM statement 159BIHISTOGRAM3DPARM statement

167BLOCKPLOT statement 176BOXPLOT statement 188BOXPLOTPARM statement 203CONTOURPLOTPARM statement 211DENSITYPLOT statement 220DROPLINE statement 227ELLIPSE statement 234ELLIPSEPARM statement 244FRINGEPLOT statement 248HISTOGRAM statement 256

604 Index

Page 615: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

HISTOGRAMPARM statement 263LINEPARM statement 273LOESSPLOT statement 281MODELBAND statement 288NEEDLEPLOT statement 296PBSPLINEPLOT statement 305REFERENCELINE statement 314REGRESSIONPLOT statement 321SCATTERPLOT statement 331SCATTERPLOTMATRIX statement

346SERIESPLOT statement 358STEPPLOT statement 371SURFACEPLOTPARM statement 380VECTORPLOT statement 389

NBINS= optionHISTOGRAM statement 256

NEEDLEPLOT statement 291NHINT= option

CONTOURPLOTPARM statement 211NKNOTS= regression option

PBSPLINEPLOT statement 302NLEVELS= option

CONTOURPLOTPARM statement 211NMISS function 551NMVAR statement

TEMPLATE procedure 13, 543non-grouped data

lines, colors, and marker symbols 117NORMAL distribution option

DENSITYPLOT statement 217NOTES statement

TEMPLATE procedure 13, 543number value type 561NUMERATE function 550numeric-column value type 561

OODS Graphics

managing java memory 579ODS GRAPHICS statement

BORDER= option 16HEIGHT= option 16, 116IMAGENAME= option 116overview 15, 116sizing a graph 16, 116specifying a graph border 16WIDTH= option 16, 116

ODS stylescustomizing a style 119overriding style element defaults 511use in templates 16

OFFSETMAX= optiondatalattice, datapanel axis options 475lattice axis options 442

overlay axis options 410overlay3d axis options 428XAXISOPTS=, YAXISOPTS= options,

overlayequated axis 462OFFSETMIN= option

datalattice, datapanel axis options 475lattice axis options 442overlay axis options 410overlay3d axis options 429XAXISOPTS=, YAXISOPTS= options,

overlayequated axis 463OPAQUE= option

CONTINUOUSLEGEND statement496

DISCRETELEGEND statement 504ENTRY statement 521ENTRYFOOTNOTE statement 529ENTRYTITLE statement 537LAYOUT DATALATTICE statement

44LAYOUT DATAPANEL statement 58LAYOUT GRIDDED statement 70LAYOUT LATTICE statement 86LAYOUT OVERLAY statement 93LAYOUT OVERLAY3D statement 106LAYOUT OVERLAYEQUATED

statement 100options

value types 559ORDER= option

DISCRETELEGEND statement 504LAYOUT DATAPANEL statement 58LAYOUT GRIDDED statement 70LAYOUT LATTICE statement 86

ORIENT= optionBARCHART statement 147BARCHARTPARM statement 159BOXPLOT statement 188BOXPLOTPARM statement 203CONTINUOUSLEGEND statement

496DENSITYPLOT statement 220HISTOGRAM statement 256HISTOGRAMPARM statement 263

ORIGIN=LINEAROPTS= option, overlay axis

413OUTLIERATTRS= option

BOXPLOT statement 188BOXPLOTPARM statement 203

OUTLINEATTRS= optionBANDPLOT statement 135BARCHART statement 147BARCHARTPARM statement 159BIHISTOGRAM3DPARM statement

167

Index 605

Page 616: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

BLOCKPLOT statement 176BOXPLOT statement 188BOXPLOTPARM statement 203ELLIPSE statement 234ELLIPSEPARM statement 244HISTOGRAM statement 256HISTOGRAMPARM statement 263MODELBAND statement 288

output on templates 15OVERLAY layout 29, 89, 95overlay-type layouts

cycling through group attributes 121overview 8

OVERLAY3D layout 30, 103OVERLAYEQUATED layout 29

PP1 function 551P25 function 551P5 function 551P50 function 551P75 function 551P90 function 551P95 function 551P99 function 551PAD= option

BEGINGRAPH statement 25CONTINUOUSLEGEND statement

496DISCRETELEGEND statement 505ENTRY statement 521ENTRYFOOTNOTE statement 529ENTRYTITLE statement 537LAYOUT DATALATTICE statement

44LAYOUT DATAPANEL statement 59LAYOUT GRIDDED statement 70LAYOUT LATTICE statement 87LAYOUT OVERLAY statement 93LAYOUT OVERLAY3D statement 106LAYOUT OVERLAYEQUATED

statement 100PANELNUMBER= option

LAYOUT DATALATTICE statement44

LAYOUT DATAPANEL statement 59parameterized plots 10PATTERN= attribute

for lines 565PBSPLINEPLOT statement 299PERCENTILE= option

BOXPLOT statement 188percentiles

calculating 188empirical distribution function 188

weighted average 188plot area

and curve label location 123plot area, defined 7plot statements

2D and 3D 10computed 10conditional logic 14, 553expressions on 546overview 10parameterized 10value types for options 559

plots, defined 7PRIMARY= option

BARCHART statement 148BARCHARTPARM statement 159BIHISTOGRAM3DPARM statement

167BOXPLOT statement 189BOXPLOTPARM statement 204CONTOURPLOTPARM statement 211DENSITYPLOT statement 220HISTOGRAM statement 256HISTOGRAMPARM statement 264LOESSPLOT statement 281NEEDLEPLOT statement 296PBSPLINEPLOT statement 306REGRESSIONPLOT statement 321SCATTERPLOT statement 331SERIESPLOT statement 358STEPPLOT statement 371SURFACEPLOTPARM statement 380VECTORPLOT statement 389

PROBT function 551PROC TEMPLATE

See TEMPLATE procedureprogramming features, runtime 12, 543,

545, 549, 553PROTOTYPE layout 29, 109

with LAYOUT DATALATTICE 37with LAYOUT DATAPANEL 52

QQ1 function 551Q3 function 551QRANGE function 551quantiles

empirical distribution function 188weighted average 188

RRANGE function 551REFERENCELINE statement 309REGRESSIONPLOT statement 315

606 Index

Page 617: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

remapping colors, fills, markers, lines 121REPEATEDVALUES= option

BLOCKPLOT statement 176REVERSE= option

datalattice, datapanel axis options 475overlay axis options 410

REVERSECOLORMODEL= optionCONTOURPLOTPARM statement 211SCATTERPLOT statement 332SCATTERPLOTMATRIX statement

346SURFACEPLOTPARM statement 381

REWEIGHT= regression optionLOESSPLOT statement 278

ROLENAME= optionBANDPLOT statement 135BARCHARTPARM statement 160FRINGEPLOT statement 248HISTOGRAMPARM statement 264NEEDLEPLOT statement 296SCATTERPLOT statement 332SCATTERPLOTMATRIX statement

346SERIESPLOT statement 359STEPPLOT statement 371VECTORPLOT statement 389

ROTATE= optionENTRY statement 522LAYOUT OVERLAY3D statement 107

ROW2HEADERS statementLAYOUT LATTICE statement 81

ROWAXES blockin LAYOUT LATTICE 80

ROWAXIS statementin LAYOUT LATTICE 80LAYOUT LATTICE statement 437

ROWAXISOPTS= optionLAYOUT DATALATTICE statement

45, 467LAYOUT DATAPANEL statement 59,

467ROWDATARANGE= option

LAYOUT DATALATTICE statement45

LAYOUT DATAPANEL statement 60LAYOUT LATTICE statement 80, 87

ROWGUTTER= optionLAYOUT DATALATTICE statement

45LAYOUT DATAPANEL statement 60LAYOUT GRIDDED statement 71LAYOUT LATTICE statement 88

ROWHEADERS statementLAYOUT LATTICE statement 81

ROWHEADERS= option

LAYOUT DATALATTICE statement45

ROWS= optionLAYOUT DATALATTICE statement

45LAYOUT DATAPANEL statement 60LAYOUT GRIDDED statement 71LAYOUT LATTICE statement 88

ROWVAR= argumentLAYOUT DATALATTICE statement

36ROWVARS= option

SCATTERPLOTMATRIX statement347

ROWWEIGHTS= optionLAYOUT LATTICE statement 88

runtime programming features 12, 543,545, 549, 553

SSAS formats

error message in log 569unsupported currency formats 571unsupported date and time formats 570unsupported numeric formats 569using 569

SCALE= optionHISTOGRAM statement 256VECTORPLOT statement 389

SCATTERPLOT statement 323SCATTERPLOTMATRIX statement 335SEMIMAJOR= argument

ELLIPSEPARM statement 240SEMIMINOR= argument

ELLIPSEPARM statement 240SERIESPLOT statement 351SGRENDER procedure 3, 6SHORTLABEL=

XAXISOPTS=, YAXISOPTS= options,overlayequated axis 463

SHORTLABEL= optiondatalattice, datapanel axis options 476lattice axis options 442overlay axis options 410

SHORTTEXT= optionENTRYFOOTNOTE statement 530ENTRYTITLE statement 538

SIDEBAR statementwith LAYOUT DATALATTICE 37with LAYOUT DATAPANEL 52with LAYOUT LATTICE 82

SIZE= attributefor markers 565for text 566

sizing a graph 16, 116

Index 607

Page 618: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

SKEWNESS function 552SKIPEMPTYCELLS= option

LAYOUT DATALATTICE statement46

LAYOUT DATAPANEL statement 60LAYOUT LATTICE statement 88

SLOPE= argumentELLIPSEPARM statement 241LINEPARM statement 269

SMOOTH= regression optionLOESSPLOT statement 277PBSPLINEPLOT statement 302

SPARSE= optionLAYOUT DATAPANEL statement 61

SPLITTICKVALUE=TIMEOPTS= option, datalattice or

datapanel axis 486TIMEOPTS= option, lattice axis 452TIMEOPTS= option, overlay axis 421

SPREAD= optionBOXPLOT statement 189BOXPLOTPARM statement 204

START= optionLAYOUT DATALATTICE statement

46LAYOUT DATAPANEL statement 62SCATTERPLOTMATRIX statement

347STAT= argument

BOXPLOTPARM statement 196STAT= option

BARCHART statement 148statement arguments

expressions on 546statement options

value types 559STDDEV function 552STDERR function 552STEPPLOT statement 361string value type 562string-column value type 562style-reference

fill options 564line options 564marker options 565text options 566

style-reference value type 562STYLE= attribute

for text 566styles

See ODS stylesSUB text command

ENTRY statement 513, 522ENTRYFOOTNOTE statement 513,

530ENTRYTITLE statement 513, 538

example uses 513subscript text

See SUB text commandSUM function 552SUMWGT function 552SUP text command

ENTRY statement 513, 522ENTRYFOOTNOTE statement 513,

530ENTRYTITLE statement 513, 538example uses 513

superscript textSee SUP text command

SURFACECOLORGRADIENT= optionSURFACEPLOTPARM statement 381

SURFACEPLOTPARM statement 375SURFACETYPE= option

SURFACEPLOTPARM statement 381SYMBOL= attribute

for markers 565

TT function 552TEMPLATE procedure 3

BEGINGRAPH statement 4conditional logic on 14, 553DEFINE STATGRAPH statement 4DYNAMIC statement 13, 543dynamics on 13, 543expressions 12flexible templates 12functions 12macro variables on 13, 543MVAR statement 13, 543NMVAR statement 13, 543NOTES statement 13, 543types of templates 543

templatesanatomy of a graph 7attribute options 117axes 7, 10BEGINGRAPH statement 4cell 7compiling 5conditional logic on 14, 553curve labels 123DEFINE STATGRAPH statement 4DISPLAY= option 122dynamics on 13, 543expressions 12flexible templates 12footnote area 7functions 12graph 7grouped data 119

608 Index

Page 619: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

image format 116image name 116image size 116interactions between options 122layout statements 8legends 8, 11macro variables on 13minimum requirements for a plot 115non-grouped data 117ODS Graphics environment 116ODS GRAPHICS statement 15output 15overview 3plot area 7plot display 117plot types 10plots 7rendering a graph 3runtime actions 6SGRENDER procedure 3, 6styles 16title area 7

text attributesexample uses 511specifying text color 566specifying text font family 566specifying text size 566specifying text style 566specifying text weight 566

text commandsexample uses 512

TEXTATTRS= prefix optionENTRY statement 511, 522ENTRYFOOTNOTE statement 511,

530ENTRYTITLE statement 511, 538example uses 511

TEXTFITPOLICY= optionENTRYFOOTNOTE statement 530ENTRYTITLE statement 538

THICKNESS= attributefor lines 565

THRESHOLDMAX=LINEAROPTS= option, datalattice or

datapanel axis 478LINEAROPTS= option, lattice axis 445LINEAROPTS= option, overlay axis

414LINEAROPTS= option, overlay3d axis

430XAXISOPTS=, YAXISOPTS= options,

overlayequated axis 463THRESHOLDMIN=

LINEAROPTS= option, datalattice ordatapanel axis 478

LINEAROPTS= option, lattice axis 445

LINEAROPTS= option, overlay axis414

LINEAROPTS= option, overlay3d axis430

XAXISOPTS=, YAXISOPTS= options,overlayequated axis 463

TICKINTERVALSTYLE=LOGOPTS= option, datalattice or

datapanel axis 483LOGOPTS= option, lattice axis 449LOGOPTS= option, overlay axis 418

TICKSTYLE=COMMONAXISOPTS= option,

overlayequated axis 457overlay axis options 410

TICKVALUEATTRS=XAXISOPTS=, YAXISOPTS= options,

overlayequated axis 463TICKVALUEATTRS= option

datalattice, datapanel axis options 476lattice axis options 443overlay axis options 411overlay3d axis options 429

TICKVALUEFITPOLICY=DISCRETEOPTS= option, datalattice or

datapanel axis 477DISCRETEOPTS= option, lattice axis

443LINEAROPTS= option, datalattice or

datapanel axis 479LINEAROPTS= option, lattice axis 445LINEAROPTS= option, overlay axis

414TIMEOPTS= option, datalattice or

datapanel axis 486TIMEOPTS= option, lattice axis 453TIMEOPTS= option, overlay axis 422XAXISOPTS=, YAXISOPTS= options,

overlayequated axis 464TICKVALUEFORMAT=

LINEAROPTS= option, datalattice ordatapanel axis 479

LINEAROPTS= option, lattice axis 446LINEAROPTS= option, overlay axis

415LINEAROPTS= option, overlay3d axis

431TIMEOPTS= option, datalattice or

datapanel axis 487TIMEOPTS= option, lattice axis 453TIMEOPTS= option, overlay axis 422TIMEOPTS= option, overlay3d axis

434XAXISOPTS=, YAXISOPTS= options,

overlayequated axis 464TICKVALUELIST=

Index 609

Page 620: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

COMMONAXISOPTS= option,overlayequated axis 457

LINEAROPTS= option, datalattice ordatapanel axis 480

LINEAROPTS= option, lattice axis 447LINEAROPTS= option, overlay axis

415LINEAROPTS= option, overlay3d axis

431TIMEOPTS= option, datalattice or

datapanel axis 487TIMEOPTS= option, lattice axis 454TIMEOPTS= option, overlay axis 422TIMEOPTS= option, overlay3d axis

434TICKVALUEPRIORITY=

COMMONAXISOPTS= option,overlayequated axis 457

LINEAROPTS= option, datalattice ordatapanel axis 480

LINEAROPTS= option, lattice axis 447LINEAROPTS= option, overlay axis

416TIMEOPTS= option, lattice axis 454TIMEOPTS= option, overlay axis 423

TICKVALUESEQUENCE=COMMONAXISOPTS= option,

overlayequated axis 458LINEAROPTS= option, datalattice or

datapanel axis 481LINEAROPTS= option, lattice axis 447LINEAROPTS= option, overlay axis

416LINEAROPTS= option, overlay3d axis

432TILT= option

LAYOUT OVERLAY3D statement 107TIMEOPTS= option

datalattice, datapanel axis options 484lattice axis options 450overlay axis options 419overlay3d axis options 432

TIP= optionBANDPLOT statement 135BARCHART statement 148BARCHARTPARM statement 160FRINGEPLOT statement 248HISTOGRAMPARM statement 264NEEDLEPLOT statement 297SCATTERPLOT statement 332SCATTERPLOTMATRIX statement

347SERIESPLOT statement 359STEPPLOT statement 371VECTORPLOT statement 390

TIPFORMAT= option

BANDPLOT statement 136BARCHART statement 149BARCHARTPARM statement 160DENSITYPLOT statement 220FRINGEPLOT statement 249HISTOGRAM statement 256HISTOGRAMPARM statement 264LOESSPLOT statement 281MODELBAND statement 288NEEDLEPLOT statement 297PBSPLINEPLOT statement 306REGRESSIONPLOT statement 322SCATTERPLOT statement 333SCATTERPLOTMATRIX statement

347SERIESPLOT statement 359STEPPLOT statement 372VECTORPLOT statement 390

TIPLABEL= optionBANDPLOT statement 136BARCHART statement 149BARCHARTPARM statement 161DENSITYPLOT statement 221FRINGEPLOT statement 249HISTOGRAM statement 257HISTOGRAMPARM statement 265LOESSPLOT statement 282MODELBAND statement 289NEEDLEPLOT statement 297PBSPLINEPLOT statement 306REGRESSIONPLOT statement 322SCATTERPLOT statement 333SCATTERPLOTMATRIX statement

348SERIESPLOT statement 360STEPPLOT statement 372VECTORPLOT statement 390

title area, defined 7TITLE= option

CONTINUOUSLEGEND statement497

DISCRETELEGEND statement 505TITLEATTRS= option

CONTINUOUSLEGEND statement497

DISCRETELEGEND statement 505TITLEBORDER= option

DISCRETELEGEND statement 505type conversion

in expressions 546TYPE= option

BANDPLOT statement 137datalattice, datapanel axis options 476ELLIPSE statement 234lattice axis options 443overlay axis options 411

610 Index

Page 621: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

overlay3d axis options 429

UUCLM function 552UNICODE text command

ENTRY statement 513, 523ENTRYFOOTNOTE statement 513,

531ENTRYTITLE statement 513, 539example uses 513

Unicode valuesSee UNICODE text command

URL= optionBARCHART statement 149BARCHARTPARM statement 161NEEDLEPLOT statement 298SCATTERPLOT statement 333SERIESPLOT statement 360STEPPLOT statement 372

USS function 552

VVALIGN= option

CONTINUOUSLEGEND statement497

DISCRETELEGEND statement 505ENTRY statement 523LAYOUT GRIDDED statement 71LAYOUT LATTICE statement 88

value typesarrow 559boolean 559color 560column 560dimension 561expression 561for statement options 559format 561integer 561integer-column 561line-pattern-name 561line-pattern-number 561marker-name 561number 561numeric-column 561string 562string-column 562style-reference 562

VALUEATTRS= optionBLOCKPLOT statement 177CONTINUOUSLEGEND statement

497DISCRETELEGEND statement 506

VALUECOUNT= option

CONTINUOUSLEGEND statement498

VALUECOUNTHINT= optionCONTINUOUSLEGEND statement

498VALUEFITPOLICY= option

BLOCKPLOT statement 177VALUEHALIGN= option

BLOCKPLOT statement 177VALUEVALIGN= option

BLOCKPLOT statement 177VAR function 552VECTORPLOT statement 383VIEWMAX=

COMMONAXISOPTS= option,overlayequated axis 459

LINEAROPTS= option, datalattice ordatapanel axis 481

LINEAROPTS= option, lattice axis 448LINEAROPTS= option, overlay axis

417LOGOPTS= option, datalattice or

datapanel axis 484LOGOPTS= option, lattice axis 450LOGOPTS= option, overlay axis 419TIMEOPTS= option, datalattice or

datapanel axis 487TIMEOPTS= option, lattice axis 454TIMEOPTS= option, overlay axis 423

VIEWMIN=COMMONAXISOPTS= option,

overlayequated axis 459LINEAROPTS= option, datalattice or

datapanel axis 482LINEAROPTS= option, lattice axis 448LINEAROPTS= option, overlay axis

417LOGOPTS= option, datalattice or

datapanel axis 484LOGOPTS= option, lattice axis 450LOGOPTS= option, overlay axis 419TIMEOPTS= option, datalattice or

datapanel axis 488TIMEOPTS= option, lattice axis 454TIMEOPTS= option, overlay axis 423

WWALLCOLOR= option

LAYOUT OVERLAY statement 93LAYOUT OVERLAY3D statement 107LAYOUT OVERLAYEQUATED

statement 100LAYOUT PROTOTYPE statement 110SCATTERPLOTMATRIX statement

348

Index 611

Page 622: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

WALLDISPLAY= optionLAYOUT OVERLAY statement 93LAYOUT OVERLAY3D statement 107LAYOUT OVERLAYEQUATED

statement 100LAYOUT PROTOTYPE statement 111SCATTERPLOTMATRIX statement

348WEIGHT= attribute

for markers 566for text 566

WEIGHT= regression optionLOESSPLOT statement 278PBSPLINEPLOT statement 302REGRESSIONPLOT statement 318

WHISKERATTRS= optionBOXPLOT statement 189BOXPLOTPARM statement 204

width, specifying on a graph 16, 116WIDTH= option, ODS GRAPHICS

statement 16, 116

XX= argument

BANDPLOT statement 129BARCHART statement 141BARCHARTPARM statement 153BIHISTOGRAM3DPARM statement

165BLOCKPLOT statement 172BOXPLOT statement 181BOXPLOTPARM statement 196CONTOURPLOTPARM statement 207DROPLINE statement 225ELLIPSE statement 232LINEPARM statement 269LOESSPLOT statement 277NEEDLEPLOT statement 292PBSPLINEPLOT statement 301REFERENCELINE statement 311REGRESSIONPLOT statement 317SCATTERPLOT statement 324SERIESPLOT statement 352STEPPLOT statement 364SURFACEPLOTPARM statement 379VECTORPLOT statement 385

X2AXISOPTS= optionLAYOUT OVERLAY statement 94,

405XAXIS= option

BANDPLOT statement 137BARCHART statement 149BARCHARTPARM statement 161BLOCKPLOT statement 177BOXPLOT statement 189

BOXPLOTPARM statement 204CONTOURPLOTPARM statement 211DENSITYPLOT statement 221DROPLINE statement 227ELLIPSE statement 234ELLIPSEPARM statement 244FRINGEPLOT statement 249HISTOGRAM statement 257HISTOGRAMPARM statement 265LINEPARM statement 274LOESSPLOT statement 282MODELBAND statement 289NEEDLEPLOT statement 298PBSPLINEPLOT statement 306REFERENCELINE statement 314REGRESSIONPLOT statement 322SCATTERPLOT statement 334SERIESPLOT statement 360STEPPLOT statement 373VECTORPLOT statement 391

XAXISOPTS= optionLAYOUT OVERLAY statement 94,

405LAYOUT OVERLAY3D statement

108, 425LAYOUT OVERLAYEQUATED

statement 101, 455, 459XERRORLOWER= option

SCATTERPLOT statement 334XERRORUPPER= option

SCATTERPLOT statement 334XORIGIN= argument

ELLIPSEPARM statement 241VECTORPLOT statement 385

XVALUES= optionBIHISTOGRAM3DPARM statement

167HISTOGRAM statement 257HISTOGRAMPARM statement 265

YY= argument

BANDPLOT statement 129BARCHART statement 141BARCHARTPARM statement 153BIHISTOGRAM3DPARM statement

165BOXPLOT statement 181BOXPLOTPARM statement 196CONTOURPLOTPARM statement 207DROPLINE statement 225ELLIPSE statement 232LINEPARM statement 269LOESSPLOT statement 277NEEDLEPLOT statement 293

612 Index

Page 623: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

PBSPLINEPLOT statement 301REFERENCELINE statement 311REGRESSIONPLOT statement 317SCATTERPLOT statement 324SERIESPLOT statement 352STEPPLOT statement 364SURFACEPLOTPARM statement 379VECTORPLOT statement 385

Y2AXISOPTS= optionLAYOUT OVERLAY statement 94,

405YAXIS= option

BANDPLOT statement 137BARCHART statement 150BARCHARTPARM statement 161BOXPLOT statement 190BOXPLOTPARM statement 204CONTOURPLOTPARM statement 211DENSITYPLOT statement 221DROPLINE statement 228ELLIPSE statement 234ELLIPSEPARM statement 244HISTOGRAM statement 257HISTOGRAMPARM statement 265LINEPARM statement 274LOESSPLOT statement 282MODELBAND statement 289NEEDLEPLOT statement 298PBSPLINEPLOT statement 306REFERENCELINE statement 314REGRESSIONPLOT statement 322SCATTERPLOT statement 334SERIESPLOT statement 360

STEPPLOT statement 373VECTORPLOT statement 391

YAXISOPTS= optionLAYOUT OVERLAY statement 94,

405LAYOUT OVERLAY3D statement

108, 425LAYOUT OVERLAYEQUATED

statement 101, 455, 459YERRORLOWER= option

SCATTERPLOT statement 334YERRORUPPER= option

SCATTERPLOT statement 334YORIGIN= argument

ELLIPSEPARM statement 241VECTORPLOT statement 385

YVALUES= optionBIHISTOGRAM3DPARM statement

167

ZZ= argument

BIHISTOGRAM3DPARM statement165

CONTOURPLOTPARM statement 207SURFACEPLOTPARM statement 379

ZAXISOPTS= optionLAYOUT OVERLAY3D statement

108, 425ZOOM= option

LAYOUT OVERLAY3D statement 108

Index 613

Page 624: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

614 Index

Page 625: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template

Your Turn

We welcome your feedback.

• If you have comments about this book, please send them to [email protected] the full title and page numbers (if applicable).

• If you have comments about the software, please send them to [email protected].

Page 626: SAS/GRAPH 9.2 Graph Template Language Referencesupport.sas.com/documentation/cdl/en/grstatgraph/... · Chapter 6 • LAYOUT GRIDDED Statement ... Chapter 1 Overview Graph Template