SAS ODS Graphics Designer by Example : A Visual Guide to Creating Graphs Interactively by Jeanette Bottitta and Sanjay Matange


8659fbfb33e2f90.jpg Author Jeanette Bottitta and Sanjay Matange
Isbn 9781612901916
File size 2.88MB
Year 2016
Pages 148
Language English
File format PDF
Category software



 

The correct bibliographic citation for this manual is as follows: Matange, Sanjay and Jeanette Bottitta. 2016. SAS® ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively. Cary, NC: SAS Institute Inc. SAS® ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively Copyright © 2016, SAS Institute Inc., Cary, NC, USA ISBN 978-1-61290-191-6 (Hard copy) ISBN 978-1-62960-547-0 (EPUB) ISBN 978-1-62960-548-7 (MOBI) ISBN 978-1-62960-549-4 (PDF) All Rights Reserved. Produced in the United States of America. For a hard copy book: No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc. For a web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication. The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher is illegal and punishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronic piracy of copyrighted materials. Your support of others’ rights is appreciated. U.S. Government License Rights; Restricted Rights: The Software and its documentation is commercial computer software developed at private expense and is provided with RESTRICTED RIGHTS to the United States Government. Use, duplication, or disclosure of the Software by the United States Government is subject to the license terms of this Agreement pursuant to, as applicable, FAR 12.212, DFAR 227.7202-1(a), DFAR 227.7202-3(a), and DFAR 227.7202-4, and, to the extent required under U.S. federal law, the minimum restricted rights as set out in FAR 52.227-19 (DEC 2007). If FAR 52.227-19 is applicable, this provision serves as notice under clause (c) thereof and no other notice is required to be affixed to the Software or documentation. The Government’s rights in Software and documentation shall be only those set forth in this Agreement. SAS Institute Inc., SAS Campus Drive, Cary, NC 27513-2414 December 2016 SAS® and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are trademarks of their respective companies. SAS software may be provided with certain third-party software, including but not limited to open-source software, which is licensed under its applicable third-party software license agreement. For license information about third-party software distributed with SAS software, refer to http://support.sas.com/thirdpartylicenses. Contents Preface .............................................................................................. vii About this Book .................................................................................. ix About these Authors............................................................................xiii Acknowledgments ............................................................................... xv Chapter 1: Introduction to Creating Graphs .......................................... 1 The Value of a Graph .............................................................................................................. 1 Automatic Graphs ................................................................................................................... 2 Creating Graphs Using the Graph Template Language ...................................................... 4 Creating Graphs Using the Statistical Graphics Procedures ............................................. 6 Creating Graphs Using the SAS ODS Graphics Designer .................................................. 6 Effective Graphics and the Use of Decorative Skins .......................................................... 8 Chapter 2: Using the Designer ............................................................. 9 Start the Designer ................................................................................................................... 9 Designer Graphical User Interface ...................................................................................... 10 Menus and Toolbar......................................................................................................... 11 Graph Gallery .................................................................................................................. 11 Elements Pane: Plots and Insets .................................................................................. 12 Right-Click Pop-Up Menus ............................................................................................ 13 Create a Graph ...................................................................................................................... 13 Graph Terminology ............................................................................................................... 14 Basic Concepts and Task Workflow ................................................................................... 15 Graph Types and Layouts .................................................................................................... 16 Parameters Available for the SGDESIGN Macro ............................................................... 17 Chapter 3: Create Your First Graph .................................................... 19 About This Example .............................................................................................................. 19 Create Your Graph ................................................................................................................ 20 Create a Histogram from the Graph Gallery ................................................................ 20 Assign Data to the Histogram ....................................................................................... 23 iv Change the Title and Remove the Footnote ................................................................ 24 Add Plots to the Graph ................................................................................................... 25 Set Plot Properties ......................................................................................................... 28 Add and Modify a Legend .............................................................................................. 30 Add a Row to the Graph................................................................................................. 32 Add a Horizontal Box Plot to the Empty Cell ............................................................... 33 Use a Common X Axis .................................................................................................... 35 View the GTL Code ......................................................................................................... 36 Copy and Paste the Graph to Another Application ..................................................... 36 Save the Graph to a File ................................................................................................. 37 Save the Graph in the Graph Gallery ............................................................................ 37 Run the Graph in Batch Mode ....................................................................................... 39 Chapter 4: Understanding Plot Types, Data Roles, and the Visual Properties of a Graph ......................................................................... 41 Review of the Process for Creating Graphs ....................................................................... 41 Plots and Insets Groups ....................................................................................................... 42 Basic Plots....................................................................................................................... 42 Fit Plots ............................................................................................................................ 43 Distribution Plots ............................................................................................................ 43 Categorization Plots ....................................................................................................... 44 Other Plots ...................................................................................................................... 44 Insets ............................................................................................................................... 44 Summary of Combining Plots and Insets ..................................................................... 45 Data Assignment When Adding a Plot ................................................................................ 45 Data Assignment from the Pop-Up Menu .......................................................................... 48 Custom Features of Other Assign Data Dialog Boxes ...................................................... 49 Fit an Existing Plot .......................................................................................................... 50 Model Band Options ....................................................................................................... 51 Statistics Data in the Assign Data Dialog Box............................................................. 51 Visual Properties of a Graph ................................................................................................ 52 Styles and Style Elements .................................................................................................... 52 Overview of Styles and Style Elements ........................................................................ 52 Commonly Used Style Elements ................................................................................... 53 Properties That Affect the Entire Graph ............................................................................. 54 Plot Properties ....................................................................................................................... 57 v Chapter 5: Classification Panels and Multi-Cell Graphs ...................... 61 About Classification Panels ................................................................................................. 61 Create a Classification Panel ............................................................................................... 63 About This Example ....................................................................................................... 63 Create the Graph, Add a Highlow Plot, and Specify the Panel Variable ................... 64 Add Titles to the Graph .................................................................................................. 67 Modify the Axis Properties ............................................................................................ 68 Apply a Different Style to the Graph ............................................................................. 70 About Multi-Cell Graphs ....................................................................................................... 71 Create a Multi-Cell Graph .................................................................................................... 71 About This Example ....................................................................................................... 71 Create the Graph ............................................................................................................ 72 Apply a Different Style to the Graph ............................................................................. 74 Change the Marker Symbol for the Scatter Plots ....................................................... 75 Add a Discrete Legend to the Cell ................................................................................ 77 Add a Global Legend to the Graph ............................................................................... 78 Add an Axis Table in a Separate Cell ........................................................................... 80 Customize the Titles and Remove the Footnote ......................................................... 83 Chapter 6: Auto Charts: Bulk Generation of Charts ............................ 85 About Auto Charts and Bulk Generation of Charts ........................................................... 85 The Auto Charts Window ..................................................................................................... 86 About the Auto Charts Example .......................................................................................... 87 Generate Bulk Graphs .......................................................................................................... 88 Customize Your Graph ......................................................................................................... 89 Create Your Graph ......................................................................................................... 89 Add an Axis Table to the Graph .................................................................................... 91 Customize the Titles....................................................................................................... 94 Chapter 7: Advanced Features ........................................................... 97 About the Advanced Features ............................................................................................. 97 Overview of Graph Reuse .................................................................................................... 98 Create a Shared-Variable Graph with a Dynamic Title ..................................................... 99 Create the Shared-Variable Graph ............................................................................... 99 Add Cells and Plots to the Graph................................................................................ 101 Assign a Different Variable to the Graph ................................................................... 104 Add a Dynamic Title and Save the Graph .................................................................. 105 Generate the Graph Using the SGDESIGN Procedure ............................................. 106 vi Customize the Axes ............................................................................................................ 109 About This Example ..................................................................................................... 110 Create the Graph .......................................................................................................... 110 Customize the Axis Properties .................................................................................... 112 Add an Axis Table to the Graph .................................................................................. 114 Customize the Appearance of Grouped Data .................................................................. 116 About This Example ..................................................................................................... 116 Create the Graph .......................................................................................................... 117 Change the Bar Fill and Outline Color Group Attributes .......................................... 119 Where to Go from Here ...................................................................................................... 122 Appendix: Code for Select Examples ................................................ 123 Code for the First Example in Chapter 1 .......................................................................... 123 Code for the Classification Panel Example in Chapter 5 ................................................ 124 Code for the Survival Plot Example in Chapter 5............................................................. 125 Code for the Axis Customization in Chapter 7................................................................. 126 Index................................................................................................ 127 Preface SAS has always provided powerful syntax-based procedures to create graphs. In SAS 9.2, SAS analytical procedures generated modern statistical graphs automatically with tables. New statistical graphics (SG) procedures and the Graph Template Language (GTL) were released, greatly enhancing the user’s ability to create modern statistical and analytical graphs. However, there is a segment of the SAS user community who prefers to create graphs using an interactive application. Often, these users do their data analysis in SAS, and then they export their data to third-party applications to create the graphs. These users have long desired an interactive application in SAS for creating graphs. With SAS 9.2 Phase 2, the SAS ODS Graphics Designer (the designer) was released. The designer is an interactive application that makes creating graphs easy. This enables the SAS user to focus on the analytical task—not spending time learning procedure syntax or exporting data to other applications to create graphs. The designer leverages the features of GTL under the covers. The GUI is an easy-to-use wrapper on GTL technology. The interactive actions performed by the user are converted into appropriate GTL syntax to create the graph, which has the following benefits: ● ● ● ● ● Making graphs with the designer is easy. No programming is required. The designer uses GTL to create the graphs. That means that graphs have the same look and feel as other graphs created by SAS procedures. You can see the syntax being created for you. So, the designer can be an excellent learning tool for users who want to learn GTL. The designer is an excellent prototyping tool for graph programmers. These users can quickly create different graphs using the designer, and then customize final versions using GTL syntax. You can run the designer graphs in batch with the same data or different data. The target audience for the designer is the user who wants to create an analytical graph using an interactive application. You can launch the designer directly from a SAS session, build your graph from scratch, or start with a graph from the Graph Gallery. You can copy your graph directly into another application such as Microsoft Word or PowerPoint or into an email. You can save your graph for future use or run your saved graph in a SAS batch process using the same data or different data. The designer is particularly useful to the SAS user who wants to quickly visualize raw data or create a graph from the results of a custom analysis. Often, you already have a mental image of the graph that you want to build—you just need to know how to build it. This book shows you the step-by-step process of building graphs commonly used in various domains. With the designer, you can literally build a graph in under a minute. viii SAS ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively This book describes the extensive features of the designer. It includes examples of graphs commonly used for the analysis of data. You can browse the graph examples and find the type of graph you want to create. Each example shows the detailed steps needed to create the graph. As with GTL, the designer uses a building-block approach to creating graphs. You start with a basic plot, and then simply add the features that you need, one at a time. The designer supports a large number of plot types and options, so the possible combinations grow rapidly. Simple plot types can be combined to create complex plots. Visual aesthetics are built in by default. From the examples, it becomes evident that you have to do very little to get aesthetically pleasing graphs. The designer is designed with the principles of effective graphics in mind to convey information with maximum clarity and minimum clutter. The examples and techniques discussed in this book are relevant and useful for all SAS users. This book is focused on how to create the required graph given the data. Techniques for modeling and analysis of the data itself are beyond the scope of this book. About This Book What Does This Book Cover? This step-by-step guide is intended to facilitate the creation of graphs using the SAS ODS Graphics Designer (the designer). The book describes the graphical interface and features of the designer in detail, showing you how to use an interactive application to create the graph that you need. Topics are organized by feature, making this an excellent training manual or self-tutorial. With this book, you will quickly learn how to create simple or complex graphical views of data for analysis. This book covers main graphics features, such as single-cell graphs, multi-cell graphs, classification panels, data roles, plot types, legends, titles and footnotes, styles, and the visual properties of a graph. The book provides details about some advanced features, including automatically generated charts, shared-variable graphs, and axis customization. This book does not cover all the features of the designer. You are encouraged to refer to the SAS ODS Graphics Designer: User’s Guide for complete concepts. Is This Book for You? This book is useful if you want to create graphs using a simple, interactive application. You do not have to be familiar with procedure syntax for creating graphs. The first two chapters provide introductory information about ODS graphing software in general and the SAS ODS Graphics Designer in particular. If you are familiar with these concepts, you can skim the first two chapters and move on to the example in Chapter 3. You might also find the book useful if you are an experienced graph programmer who wants to perform rapid prototyping of your data using the designer. If you want to learn the basics of the Graph Template Language (GTL), the designer can introduce you to GTL code. What Are the Prerequisites for This Book? The book requires no programming experience, although you should have a basic understanding of SAS libraries, data sets, and data roles. x SAS ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively What Should You Know about the Examples? Software Used to Develop the Book's Content This book assumes that the user has the SAS ODS Graphics Designer, Release 9.2 or later. The designer is included with SAS 9.2 Phase 2 and later. The examples were created and tested using the designer included with the third maintenance release for SAS 9.4. Platform Used to Create the Examples The examples were created in the Windows operating environment. If you are using UNIX, some of the designer’s windows might differ from what you see in this book. Example Code and Data Most of the examples in this book use data sets provided by SAS and available in the Sashelp library. These data sets include CARS, HEART, and a few others. Sometimes, the number of classifiers was reduced to fit the graph in a restricted space. As a result, modified data sets were used that include a subset of data from the original Sashelp data sets. In addition, custom data sets were needed for an example graph. When an example requires you to run SAS code, that code is available from: ● ● ● the appendix of this book http://support.sas.com/publishing/authors/matange.html http://support.sas.com/publishing/authors/bottitta.html Graph Size The default setting for graph size in the designer is 640px by 480px (pixels). This setting is specified in the Preferences dialog box along with other settings. You can modify these settings by selecting Tools ►Preferences. For this book, the default height is 350px to fit in the available space. When graphs are reduced in size, smaller graphs might have scaled-down font sizes. Also, their numeric axes might display tick values differently. As a result, the graphs that you generate from the examples will not always look identical to the graphs that are shown in the figures. However, both graphs will accurately represent the data. Styles The graphs created by the designer use the LISTING style by default. This style and other available styles are optimized for full-color output. Most of the graph examples in this book use the default LISTING style. About this Book xi Additional Help Although this book illustrates many analyses regularly performed in businesses across industries, questions specific to your aims and issues might arise. To fully support you, SAS Institute and SAS Press offer you the following help resources: ● ● ● For questions about topics covered in this book, contact the author through SAS Press: ◦ ◦ Send questions by email to [email protected]; include the book title in your correspondence. Submit feedback on the author’s page at http://support.sas.com/author_feedback. For questions about topics in or beyond the scope of this book, post queries to the relevant SAS Support Communities at https://communities.sas.com/welcome. SAS Institute maintains a comprehensive website with up-to-date information. You can get technical support, find resources for a product, and search for information at http://support.sas.com/. We Want to Hear from You SAS Press books are written by SAS Users for SAS Users. We welcome your participation in their development and your feedback on SAS Press books that you are using. Please visit https://support.sas.com/publishing to do the following: ● ● ● ● Sign up to review a book Recommend a topic Request authoring information Provide feedback on a book Do you have questions about a SAS Press book that you are reading? Contact the author through [email protected] or https://support.sas.com/author_feedback. SAS has many resources to help you find answers and expand your knowledge. If you need additional help, see our list of resources: https://support.sas.com/publishing. xii SAS ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively About These Authors Sanjay Matange is Research & Development Director in the Data Visualization Division at SAS, where he is responsible for the development and support of ODS Graphics software. This includes the Graph Template Language (GTL), Statistical Graphics (SG) procedures, ODS Graphics Designer, and other related graphics applications. Sanjay has been with SAS for over 25 years. He is coauthor of two patents and author of four SAS Press books. Jeanette Bottitta is a technical writer at SAS Institute, where she specializes in ODS Graphics software. Jeanette has over 12 years of experience writing programming guides, including the SAS® ODS Graphics Procedures Guide. She has worked with SAS ODS Graphics Designer since its initial release and enjoys its user-friendly interface. Learn more about these authors by visiting their author pages, where you can download free book excerpts, access example code and data, read the latest reviews, get updates, and more: http://support.sas.com/publishing/authors/matange.html http://support.sas.com/publishing/authors/bottitta.html xiv Acknowledgments We wish to express our gratitude to our editor, Brenna Leath, for her support and encouragement. We also want to thank Jyoti Yakowenko, Lelia McConnell, and Prashant Hebbar for their technical review of the contents. Finally, we thank Amy Wolfe for her copyedit, Denise Jones for production, and Robert Harris for the excellent art work for the cover. xvi SAS ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively Chapter 1: Introduction to Creating Graphs The Value of a Graph .................................................................................. 1 Automatic Graphs ....................................................................................... 2 Creating Graphs Using the Graph Template Language ............................... 4 Creating Graphs Using the Statistical Graphics Procedures ....................... 6 Creating Graphs Using the SAS ODS Graphics Designer ............................. 6 Effective Graphics and the Use of Decorative Skins ................................... 8 The Value of a Graph A picture is worth a thousand words. It is debatable whether this is an old Chinese proverb, or whether it is an adage attributable to a notable historic figure such as Napoleon Bonaparte or Ivan Turgenev in 1862 or Fred R. Barnard in 1927. Whoever said it, the message is clear. For modern data analysis, information is easier to grasp and decode when it is presented in an appropriate visual form. Figure 1.1 shows a table of the mean city and highway mileage, along with upper and lower confidence limits by car type for all cars in the Sashelp.Cars data set. The program to create this data set is shown in “Code for the First Example in Chapter 1” the appendix. Even for this small data set, it is not easy to get a good feel of city and highway mileage across car types. Figure 1.1 Table of Car Data 2 SAS ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively Figure 1.2 shows a simple bar chart of the same data. The graph plots the mean city and highway mileage by car type. It displays the upper and lower confidence limits and the sample size for each car type. Figure 1.2 Same Car Data Shown in a Graph Some inferences can be drawn from the graph in Figure 1.2 that are not obvious in the tabular view of the same data in Figure 1.1: ● ● ● Mileage for hybrid cars is significantly higher than for the other car types. Highway mileage is significantly higher than city mileage for all car types except hybrid. Confidence limits and sample size for each car type indicate reliability of the data. SAS ODS Graphics software, first released with SAS 9.2, has made it very easy to obtain highquality graphs with little effort in the following ways: ● ● ● ● Obtain automatic graphs from SAS analytical procedures. Create custom graphs using the Graph Template Language (GTL). Create custom graphs using the statistical graphics (SG) procedures. Create custom graphs using the interactive ODS Graphics Designer (the designer). All of these methods create graphs using a common underlying graphics system based on GTL. Graphs from any method can be used together in your reports with a consistent appearance. Let’s now take a brief look at the benefits and audience for each of the methods. Automatic Graphs Starting with SAS 9.2, high-quality graphs are automatically produced by many Base SAS, SAS/STAT, SAS/QC, SAS/ETS, and SAS High-Performance Forecasting procedures by merely switching on the ODS Graphics system. No additional graphics coding is required by the user. Chapter 1: Introduction to Creating Graphs 3 Automatic graphs are produced by using the following statements in your program: ods graphics on / options; procedure statements; ods graphics off; Note: Starting with SAS 9.3, ODS Graphics is set to ON by default for SAS procedures that support ODS Graphics when the procedures are executed in the SAS windowing environment. When ODS Graphics is enabled, graphs and tables are created in the right order and written to the output destination as shown in the following example: ods html; ods graphics on; ods select 'Analysis of Variance'; ods select 'Fit Plot'; proc reg data=sashelp.class; model Weight = Height; quit; ods graphics off; Figure 1.3 Output from the REG Procedure The audience for these types of graphs is analysts or statisticians. With SAS 9.2, for both the command line and windowing environment modes, ODS Graphics is off by default and graphics are not created automatically. The default destination is LISTING. In the previous code, the HTML destination is specified and ODS Graphics are enabled. With SAS 9.3, in command line mode, ODS Graphics is off by default. The default destination is LISTING just like it is for SAS 9.2. However, in the windowing environment mode, ODS Graphics is on by default, and the default destination is HTML. This is a change from SAS 9.2. 4 SAS ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively For more information about automatic graphs produced from procedures, refer to the product documentation for SAS/STAT or for the SAS Output Delivery System. Creating Graphs Using the Graph Template Language Graph Template Language (GTL) syntax is the foundation of ODS Graphics. GTL is the syntax used to define the structure of a graph. GTL supports many different statements to define graphs that generally fall into one of the following categories: ● Single-cell graphs. Such graphs are commonly used in various domains, and they can span from the simple scatter plot to complex model-fit plots with multiple overlaid plots, legends, and statistics. Figure 1.4 Single-Cell Graph

Author Jeanette Bottitta and Sanjay Matange Isbn 9781612901916 File size 2.88MB Year 2016 Pages 148 Language English File format PDF Category Software Book Description: FacebookTwitterGoogle+TumblrDiggMySpaceShare You just got the results from your study, and need to get some quick graphical views of your data before you begin the analysis. Do you need a crash course in the SG procedures (also known as ODS Graphics procedures) just to get a simple histogram? What should you do? The ODS Graphics Designer is the answer. With this application, you can use the interactive drag-and-drop feature to create many graphs, including histograms, box plots, scatter plot matrices, classification panels, and more. You can render your graph in batch with new data and output the results to any open ODS destination, or view the generated Graph Template Language (GTL) code as a leg-up to GTL programming. You can do all this with ease! SAS(R) ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively describes in detail the features of the ODS Graphics Designer. The designer application lets you, the analyst, create graphs interactively so that you can focus on the analysis, and not on learning graph syntax. This book will take you step-by-step through the features of the designer, providing you with examples of graphs that are commonly used for the analysis of data in the health care, life sciences, and finance industries. The examples in this book will help you create just the right graph with ease!     Download (2.88MB) Essential Excel 2016: A Step-by-Step Guide Advanced Excel , Spreadsheets, Excel Master class, Pivot Tables, Bisness Excel, Macros, VlookUP: Excel Excel Data Analysis: Your Visual Blueprint for Creating and Analyzing Data, Charts and PivotTables, 3rd Edition Excel Data Analysis Adobe Photoshop CC Keyboard Shortcuts for Windows and Macintosh. Load more posts

Leave a Reply

Your email address will not be published. Required fields are marked *