Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Clinical Graphs Using SAS
Clinical Graphs Using SAS
Clinical Graphs Using SAS
Ebook495 pages3 hours

Clinical Graphs Using SAS

Rating: 0 out of 5 stars

()

Read preview

About this ebook

SAS users in the Health and Life Sciences industry need to create complex graphs to analyze biostatistics data and clinical data, and they need to submit drugs for approval to the FDA. Graphs used in the HLS industry are complex in nature and require innovative usage of the graphics features. Clinical Graphs Using SAS® provides the knowledge, the code, and real-world examples that enable you to create common clinical graphs using SAS graphics tools, such as the Statistical Graphics procedures and the Graph Template Language.



This book describes detailed processes to create many commonly used graphs in the Health and Life Sciences industry. For SAS® 9.3 and SAS® 9.4 it covers many improvements in the graphics features that are supported by the Statistical Graphics procedures and the Graph Template Language, many of which are a direct result of the needs of the Health and Life Sciences community. With the addition of new features in SAS® 9.4, these graphs become positively easy to create.

Topics covered include the usage of SGPLOT procedure, the SGPANEL procedure and the Graph Template Language for the creation of graphs like forest plots, swimmer plots, and survival plots.
LanguageEnglish
PublisherSAS Institute
Release dateMar 21, 2016
ISBN9781629602059
Clinical Graphs Using SAS
Author

Sanjay Matange

Sanjay Matange is an R & D Director in the Data Visualization Division at SAS, responsible for the development and support of ODS Graphics. This includes the Graph Template Language (GTL), Statistical Graphics (SG) procedures, ODS Graphics Designer, and other related graphics applications. Sanjay has extensive experience in building complex graphs for all domains including Health and Life Sciences. Sanjay has been with SAS for over 25 years and is coauthor of two patents and the author of three SAS Press books.

Related to Clinical Graphs Using SAS

Related ebooks

Applications & Software For You

View More

Related articles

Reviews for Clinical Graphs Using SAS

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Clinical Graphs Using SAS - Sanjay Matange

    Preface

    Clinical data is easier to understand when presented in a visual format. The human brain allocates a large percentage of its resources to take in and process visual information rapidly. Pattern recognition is key to human survival, and we can rapidly and accurately make sense of complex visual information to make decisions. We can make judgments on visual data even when we are not focused on the task explicitly.

    In comparison to this remarkable ability developed through sheer necessity for survival, the remembering and processing of numeric data in raw tabular firm requires the explicit and intentional involvement of the cerebral cortex. The human brain is relatively slow in absorbing pure numbers, and remarkably poor in remembering more than a handful at a time. Furthermore, making evaluation of relative magnitude between such numeric data is slow.

    Graphical views of the data allows quick processing and evaluation that can help in planning the analysis phase of the project. Results of the analysis are easier to understand when they are delivered in a graphical form. Graphical representation of the data along with the derived statistical information can be a key factor in understanding of the results.

    Presenting the data as a simple bar chart or a scatter plot can help in its understanding. In some cases, sophisticated graphs with complex layouts help to understand the trends and see the associations in the data. These include graphs with raw data along with derived statistics and tabular information, classification panels by multiple class variables, scatter plot matrices of multiple measures and ad-hoc layout of dissimilar graphs necessary to display the information using multiple representations of data, often on a uniform scale.

    To create such graphs you need a language to systematically describe the complex layouts and the relationships between the different parts of the graph. Individual graphs could be created using extensive annotate functionality, but such graphs are difficult to adapt to different situations, hard to build and hard to maintain. The new graphics software included in Base SAS® such as the Graph Template Language (GTL), the Statistical Graphics (SG) Procedures, and the ODS Graphics Designer provide you with the tools you need to create complex clinical graphs.

    GTL is a comprehensive syntax to define the structure of a graph. GTL has a structured and logical syntax, necessary to build complex graphical layouts, with a large set of features. With a high level of features comes some complexity, so GTL has a significant learning curve. Often you just need a simple graph quickly. For such situations we can use the Statistical Graphics (SG) procedures, which provide an easy to use procedure like syntax to the GTL functionality.

    GTL was first released with SAS 9.2, and was initially motivated by the needs of the SAS statisticians and procedure writers to create the graphs that are automatically created by the SAS analytical procedures. SG procedures provide a simplified, value added syntax to create graphs using GTL under the covers.

    With SAS 9.3, significant new features were added to make the building of complex clinical graphs possible. This set of features was further expanded with SAS 9.4 and the maintenance releases to make clinical graphs easy. While most types of graphs can be made using the SAS 9.3 feature set, they are much easier to make using the SAS 9.4 features, many of which were developed expressly for such use cases.

    In this book, I have described how to create many clinical graphs using SAS 9.3 in Chapters 3 and 7. Many new plot types and features have been added with SAS 9.40M3 making clinical graphs much easier to create. So, the recommended way to create clinical graphs is with the SAS 9.40M3 release as shown in Chapters 4 and 8.

    Often, the SG procedures are all you need to create a large percentage of the graphs that are commonly used in the HLS domain. The SGPLOT procedure is designed to create Single-Cell graphs. These graphs comprise a very large proportion of the graphs in use that display all the data related information in one graphical data display area. Other items necessary to decode and convey the information such as legends, statistics tables, titles and footnotes are also included in the graph. The SGPANEL procedure makes it easy to create classification panels for one or more class variables.

    Often, a complex, multi cell layout is necessary to create graphs that that contain a lot of information. The data in each cell has to be displayed on a uniform scale with other data and tabular information. Such graphs need a bit more structure and functionality and are best created using GTL.

    In this book, I will organize the graphs in two categories based on complexity. Graphs we can create using SG procedures and complex graphs that require use of GTL. For each case, I will show you how to make the graph using SAS 9.3 features and also SAS 9.4. SAS 9.4 provides you with many new features that will make the task much easier.

    Clinical graphs have their own aesthetic requirements which are based on industry standard usage and requirements of scholarly journals for publications or for submissions to regulatory authorities. Such appropriate visual aesthetics are built in by default and you have to do little to get the right graph out-of-the-box. The graphics system is designed with the principles of effective graphics in mind to convey the information with maximum clarity and minimum clutter. However, extensive customizations can be done to meet your specific requirements.

    This book shows you how to create the required clinical graph given the data. Often, the data I use is simulated using mathematical functions and random number generators. The graphs themselves attempt to duplicate the presentation of data as proposed by experts in the clinical domain. My goal here is not to invent new graphical displays for clinical use, but to show you how to create displays commonly used in the industry, and how certain aspects of the displays may be better from the point of view of effectiveness of the graph. Techniques for modeling and analysis of the data itself are beyond the scope of this book.

    Chapter 1: Introduction to ODS Graphics

    1.1  A Brief History of ODS Graphics

    1.2  Automatic Graphs from SAS Analytical Procedures

    1.3  Create Custom Graphs Using the Graph Template Language (GTL)

    1.4  Create Custom Graphs Using the Statistical Graphics (SG) Procedures

    1.5  Create Custom Graphs Using the ODS Graphics Designer Application

    1.6  Data Sets and ODS Styles

    1.7  Color and Grayscale Graphs

    1.8  Summary

    There has been a sea change in SAS graphics capabilities over the past few years. The advent of ODS Graphics has made it possible for many SAS analytical procedures to create graphs as part of the procedure output. This is of great convenience to users, as many standard graphs are created automatically, providing a consistency that was absent before. All users now get a set of graphs that are carefully designed by the procedure writers for each specific procedure.

    These standard graphs are created by use of the Graph Template Language (GTL). GTL provides a flexible and structured syntax to define many types of graphs into StatGraph templates using the TEMPLATE procedure. These templates can range from the simplest scatter plot to complex diagnostics panels. These templates are then associated with data from within the analytical procedure to create the graphs. The same template can be used with different compatible data to create graphs for different use cases.

    Other tools, such as the Statistical Graphics (SG) procedures and ODS Graphics Designer, are made available that provide an easy-to-use interface to the commonly used features of GTL. You can use GTL yourself to define your own graph template and render it using the SGRENDER procedure. Or, you can use the SG procedures or Designer to create your own custom graphs. Now you have a choice of different tools.

    1.1 A Brief History of ODS Graphics

    Prior to SAS 9.2, only a few analytical procedures created graphs automatically as part of the procedure output. The normal process for creating graphs from the procedure output often required post-processing of the data. First, it was necessary to run the procedure step to compute and save the data. Then, users had to use the SAS/GRAPH procedures to create custom plots from this data.

    This process had some drawbacks.

    •   There was no standard set of graphs that were available to all users of a procedure.

    •   All users had to create their own graphs from the data.

    •   Each user had to become proficient in SAS/GRAPH code, diverting precious resources away from the analysis task itself.

    •   Important analysis data computed during the procedure step was lost once the procedure terminated.

    In light of these issues, there was a strong desire that the analytical procedures create the appropriate graphical output automatically as part of the procedure step. However, visual presentation of the output from analytical procedures requires sophisticated graphs, as each procedure has its own unique requirements. To achieve this, it was necessary to develop a new structured graphics language that would allow for the definition of complex, sophisticated graphs in a systematic way. This led to the development of ODS Graphics software and the Graph Template Language.

    The ODS Graphics software released with SAS 9.2 has made it easier for you to obtain high quality graphs with little or no effort in the following ways:

    •   You can get automatic graphs from SAS analytical procedures.

    •   You can create custom graphs using the Graph Template Language (GTL).

    •   You can create custom graphs using the Statistical Graphics (SG) procedures.

    •   You can create custom graphs using the ODS Graphics Designer application.

    Let us review the benefits and audience for each of the above methods.

    1.2 Automatic Graphs from SAS Analytical Procedures

    Many Base SAS, SAS/STAT, SAS/QC, SAS/ETS, and SAS High-Performance Forecasting procedures create high quality graphs automatically. Below, we have enabled ODS Graphics software and then run the LIFETEST procedure.

    ods graphics on;

    proc lifetest data=BMT plots=survival(atrisk=0 to 2500 by 500);

       time T * Status(0);

       strata Group / test=logrank adjust=sidak;

       run;

    Figure 1.2 – The Product-Limit Survival Estimates Graph1

    To obtain automatic graphs, all you have to do is turn on ODS Graphics.

    •   With SAS 9.3, ODS Graphics is on by default in DMS (windowing) mode, and the default output destination is HTML.

    •   In SAS 9.2 for both line and DMS modes, ODS Graphics is off by default and graphics are not created automatically. The default open destination is LISTING. ODS Graphics can be turned on by using the following statement.

    ods graphics on / < options >;

    Over 100 analytical procedures create statistical graphs as part of the analysis process. You do not need to know anything about ODS Graphics to have graphs created for you that are relevant to the analysis. The audience for such graphs is the analyst or statistician.

    1.3 Create Custom Graphs Using the Graph Template Language (GTL)

    GTL was originally designed to create complex graphs for the SAS analytical procedures. Just as with tabular data, there was a need to display the data in a graphical form for easier understanding by the user. With SAS 9.2, the Output Delivery System (ODS) was extended to support graphics in a way similar to tabular data. The TEMPLATE procedure was extended to create StatGraph templates. These templates are defined using the GTL syntax. SAS procedures use such predefined templates along with data generated during the procedure step to produce the graphs. These can vary from simple scatter plots to complex panels of fit diagnostics data.

    You can use the TEMPLATE procedure and GTL to create the StatGraph templates for your own custom graphs. GTL provides you an extensive set of plot types, layouts, and other statements for legends, attribute maps, and so on, that you can use to define the graphs that you need.

    Another important feature of ODS Graphics is the systematic usage of ODS styles for graphs. Each ODS destination has an associated default style, and all graphs and tables rendered to a destination use the attributes from the style to render themselves. The styles shipped with SAS are carefully designed to provide aesthetic output by default. You no longer have to tweak color and marker settings in the graphs to get great-looking graphs.

    The GTL syntax is the foundation of ODS Graphics software and is used to define the structure of a graph. In this book, we will use GTL to create some of the more complex graphs. The audience for GTL is the advanced graph programmer.

    1.4 Create Custom Graphs Using the Statistical Graphics (SG) Procedures

    The SG procedures create commonly used graphs using a simple and concise procedure syntax. These procedures use GTL behind the scenes to create the graphs:

    •   the SGPLOT procedure for single-cell graphs

    •   the SGPANEL procedure for classification panel graphs

    •   the SGSCATTER procedure for comparative scatter plots and matrices

    In this book we will primarily use the SGPLOT procedure to create most of the commonly used clinical graphs and the SGPANEL procedure to create classification panels. The SG procedures would be the tool of choice for programmers comfortable with using procedure syntax for creating graphs. The audience for the SG procedures is the graph programmer.

    1.5 Create Custom Graphs Using the ODS Graphics Designer Application

    The easiest, pain-free, and fastest way to create a custom graph is by using the ODS Graphics Designer, referred to in this book as Designer. The interactive Designer application is the tool of choice for you if you fit the following profile:

    •   You want to create a graph quickly using an interactive application.

    •   You are not familiar with graph syntax, and have no desire to learn it.

    •   You export your data to third-party software just to create graphs.

    Designer can help you create graphs with zero programming. Here are some key features:

    •   Designer is an interactive GUI application.

    •   You can begin your graph from a gallery of commonly used graphs.

    •   You can customize your graph by adding more plots and insets.

    •   You can create single-call graphs, classification panels, and ad hoc layouts.

    •   You can view the GTL code generated for you while creating the graph.

    •   You can save your custom graphs to the graph gallery for quick access.

    •   You can save your graph as a .sgd file to the file system.

    •   You can run a Designer graph in batch using the SGDESIGN procedure and send the graph to the open ODS destinations with the same or different data.

    Designer is not only a great interactive tool to create your graph, but it is also a great learning tool for GTL. You can see how the GTL is put together every time you make a change to the graph. You can copy the GTL code from the code window into the SAS program window and run the code. The audience for the ODS Graphics Designer is the data analyst or statistician. It can also be used by programmers for rapid prototyping or as a learning tool for GTL.

    1.6 Data Sets and ODS Styles

    Some of the examples in this book use the data sets available in the SASHELP library. These include CARS, HEART, and a few others. However, for creating clinical graphs we often need unique data sets that are not available in the SASHELP library. In this case, data is simulated using trigonometric and random number generator functions to create data appropriate for such graphs.

    Custom styles are sometimes used to render the graphs in this book. Primarily, these are necessary to reduce the font sizes to help fit the graphs into the small space available. This is especially true for examples of multi-cell graphs.

    1.7 Color and Grayscale Graphs

    The graphs are created using the active style of the open destination. Often, these styles are optimized for full color output. This works well when the graph is also viewed in a color medium.

    However, when color graphs are printed in grayscale, there is a significant loss of fidelity in the representation of distinct categories in the graph. For example, a graph with two series plots, one for Drug A and one for Drug B, can be well represented in color with use of two distinct colors such as red and blue. These colors are often designed to have equal weight to avoid unintentional bias.

    When such a graph is printed in grayscale, these two series plots can look very similar unless they have other distinguishing features such as line patterns and marker shapes. Bar charts can benefit from use of fill patterns to facilitate discrimination between classifiers.

    This book is printed in full color, so you can see the full impact of the graph. However, if you need to submit the graphs to a journal in grayscale, care should be taken to ensure that the different group classifications are easy to differentiate using marker symbols, line patterns, or fill patterns.

    1.8 Summary

    Starting with SAS 9.2, ODS Graphics software provides flexible ways to create graphs for multiple audiences.

    •   As an analyst or a statistician, you can get statistical graphs automatically from the analytical procedures. These graphs are relevant to the analysis and do not require any extra effort on your part to create.

    •   As an advanced graph programmer, you can use the GTL directly to create the complex graphs that you need. You can also create flexible graph templates that can be used with different data to create graphs.

    •   As a graph programmer, you can use the Statistical Graphics procedures to create most of the commonly used graphs in most domains.

    •   You can use the ODS Graphics Designer to quickly create graphs using a point-and-click method, without writing a single line of graph code. You can also use this tool to quickly prototype the graph you or your analyst might want, or you can generate graphs in bulk, based on the variables selected from a data set. You can also use Designer as a learning tool to learn GTL.

    Starting with SAS 9.3, ODS Graphics is included with Base SAS. With SAS 9.3 and SAS 9.4, new features and plot types have been added to the software to make creating graphs truly easy. These tools enable you to layer multiple plot types in myriad ways to create the custom graph that you want. Annotation is supported starting with SAS 9.3, and can

    Enjoying the preview?
    Page 1 of 1