Data Annotations in Clinical Trial Graphs Sudhir Singh, i3 Statprobe, Cary, NC

Similar documents
Creating Forest Plots Using SAS/GRAPH and the Annotate Facility

INTRODUCTION TO THE SAS ANNOTATE FACILITY

Multiple Forest Plots and the SAS System

Effective Forecast Visualization With SAS/GRAPH Samuel T. Croker, Lexington, SC

PharmaSUG Paper TT10 Creating a Customized Graph for Adverse Event Incidence and Duration Sanjiv Ramalingam, Octagon Research Solutions Inc.

PharmaSUG 2012 Paper CC13

A SAS Macro to Generate Caterpillar Plots. Guochen Song, i3 Statprobe, Cary, NC

Create Flowcharts Using Annotate Facility. Priya Saradha & Gurubaran Veeravel

Multiple Graphical and Tabular Reports on One Page, Multiple Ways to Do It Niraj J Pandya, CT, USA

Displaying Multiple Graphs to Quickly Assess Patient Data Trends

Data Driven Annotations: An Introduction to SAS/GRAPH s Annotate Facility

Using ANNOTATE MACROS as Shortcuts

THE IMPACT OF DATA VISUALIZATION IN A STUDY OF CHRONIC DISEASE

Coders' Corner. Paper ABSTRACT GLOBAL STATEMENTS INTRODUCTION

It s Not All Relative: SAS/Graph Annotate Coordinate Systems

Arthur L. Carpenter California Occidental Consultants

Converting Annotate to ODS Graphics. Is It Possible?

Paper: PO19 ARROW Statistical Graphic System ABSTRACT INTRODUCTION pagesize=, layout=, textsize=, lines=, symbols=, outcolor=, outfile=,

Using Annotate Datasets to Enhance Charts of Data with Confidence Intervals: Data-Driven Graphical Presentation

How to annotate graphics

Figure 1. Paper Ring Charts. David Corliss, Marketing Associates, Bloomfield Hills, MI

Customized Flowcharts Using SAS Annotation Abhinav Srivastva, PaxVax Inc., Redwood City, CA

Taming the Box Plot. Sanjiv Ramalingam, Octagon Research Solutions, Inc., Wayne, PA

Making Presentations More Fun with DATA Step Graphics Interface (DSGI) Hui-Ping Chen, Eli Lilly and Company, Indianapolis, Indiana

SUGI 29 Posters. Paper A Group Scatter Plot with Clustering Xiaoli Hu, Wyeth Consumer Healthcare., Madison, NJ

Interactive Programming Using Task in SAS Studio

Creating Complex Graphics for Survival Analyses with the SAS System

Innovative Graph for Comparing Central Tendencies and Spread at a Glance

SparkLines Using SAS and JMP

Tips for Producing Customized Graphs with SAS/GRAPH Software. Perry Watts, Fox Chase Cancer Center, Philadelphia, PA

A Generalized Procedure to Create SAS /Graph Error Bar Plots

Top Award and First Place Best Presentation of Data Lan Tran-La. Scios Nova, Inc. BLOOD PRESSURE AND HEART RATE vs TIME

A Picture is worth 3000 words!! 3D Visualization using SAS Suhas R. Sanjee, Novartis Institutes for Biomedical Research, INC.

... WHERE. AnnotaI8 Data.S... XSYS & YSYS. Harie Annotate: How Not to Lose Your Head When Enhancing BAS/GRAPH output

SAS: Proc GPLOT. Computing for Research I. 01/26/2011 N. Baker

Paper S Data Presentation 101: An Analyst s Perspective

The GANNO Procedure. Overview CHAPTER 12

Developing Graphical Standards: A Collaborative, Cross-Functional Approach Mayur Uttarwar, Seattle Genetics, Inc., Bothell, WA

FILLPATTERNS in SGPLOT Graphs Pankhil Shah, PPD, Morrisville, NC

PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA

SAS/GRAPH Introduction. Winfried Jakob, SAS Administrator Canadian Institute for Health Information

UTILIZING SAS TO CREATE A PATIENT'S LIVER ENZYME PROFILE. Erik S. Larsen, Price Waterhouse LLP

PharmaSUG 2015 Paper PO03

Tips and Tricks in Creating Graphs Using PROC GPLOT

A Juxtaposition of Tables and Graphs Using SAS /GRAPH Procedures

A Plot & a Table per Page Times Hundreds in a Single PDF file

Using The System For Medical Data Processing And Event Analysis: An Overview

Presentation Quality Graphics with SAS/GRAPH

Paper Abstract. Introduction. SAS Version 7/8 Web Tools. Using ODS to Create HTML Formatted Output. Background

SAS/GRAPH : Using the Annotate Facility

Introduction to SAS/GRAPH Statistical Graphics Procedures

IMPROVING A GRAPH USING PROC GPLOT AND THE GOPTIONS STATEMENT

Interactive Graphs from the SAS System

Custom Map Displays Created with SAS/GRAPH Procedures and the Annotate Facility Debra Miller, National Park Service, Denver, CO

Tips to Customize SAS/GRAPH... for Reluctant Beginners et al. Claudine Lougee, Dualenic, LLC, Glen Allen, VA

Data Explore Matrix Quality Control by Exploring and Mining Data in Clinical Study

Practical Uses of the DOW Loop Richard Read Allen, Peak Statistical Services, Evergreen, CO

Report Writing, SAS/GRAPH Creation, and Output Verification using SAS/ASSIST Matthew J. Becker, ST TPROBE, inc., Ann Arbor, MI

* builds the RGB color string from the color. * reads the red, green; and blue values for. * constructs an ANNOTATE dataset by

An Efficient Method to Create Titles for Multiple Clinical Reports Using Proc Format within A Do Loop Youying Yu, PharmaNet/i3, West Chester, Ohio

When Simpler is Better Visualizing Laboratory Data Using SG Procedures Wei Cheng, Isis Pharmaceuticals, Inc., Carlsbad, CA

SAS Instructions Entering the data and plotting survival curves

A Stand-Alone SAS Annotate System for Figure Generation Brian Fairfield-Carter, PRA International, Victoria, BC

SAS Graphs in Small Multiples Andrea Wainwright-Zimmerman, Capital One, Richmond, VA

Fly over, drill down, and explore

The GTESTIT Procedure

PhUse Practical Uses of the DOW Loop in Pharmaceutical Programming Richard Read Allen, Peak Statistical Services, Evergreen, CO, USA

Using SAS/GRAPH Software to Analyze Student Study Habits. Bill Wallace Computing Services University of Saskatchewan

PharmaSUG China. model to include all potential prognostic factors and exploratory variables, 2) select covariates which are significant at

%EventChart: A Macro to Visualize Data with Multiple Timed Events

How to Make an Impressive Map of the United States with SAS/Graph for Beginners Sharon Avrunin-Becker, Westat, Rockville, MD

The Plot Thickens from PLOT to GPLOT

One-Step Change from Baseline Calculations

PharmaSUG China Paper 70

From Getting Started with the Graph Template Language in SAS. Full book available for purchase here.

ABSTRACT. The SAS/Graph Scatterplot Object. Introduction

Developing a Dashboard to Aid in Effective Project Management

Chapter 1 Introduction. Chapter Contents

Pete Lund Looking Glass Analytics, Olympia, WA

Creating Maps in SAS/GRAPH

ODS LAYOUT is Like an Onion

ODS/RTF Pagination Revisit

Something for Nothing! Converting Plots from SAS/GRAPH to ODS Graphics

USING PROC GMAP AND DRILL-DOWN GRAPHICS FOR DATA QUALITY ASSURANCE Meghan Arbogast, Computer Sciences Corporation, Corvallis, OR

Posters 417. NESUG '92 Proceedings. usinq Annotate Data sets to Enhance Contour Graphics output. Shi Tao Yeh, Environmental Resources Kanaqement, ~nc.

Controlling Titles. Purpose: This chapter demonstrates how to control various characteristics of the titles in your graphs.

Not Just Merge - Complex Derivation Made Easy by Hash Object

ABC Macro and Performance Chart with Benchmarks Annotation

Graphical Techniques for Displaying Multivariate Data

From SAP to BDS: The Nuts and Bolts Nancy Brucken, i3 Statprobe, Ann Arbor, MI Paul Slagle, United BioSource Corp., Ann Arbor, MI

Combining Contiguous Events and Calculating Duration in Kaplan-Meier Analysis Using a Single Data Step

The Implementation of Display Auto-Generation with Analysis Results Metadata Driven Method

PharmaSUG Paper CC11

The GSLIDE Procedure. Overview. About Text Slides CHAPTER 27

ABSTRACT INTRODUCTION SESUG RV

Choosing the Right Procedure

Internet, Intranets, and The Web

Move =(+0,+5): Making SAS/GRAPH Work For You

Using SAS Graphics Capabilities to Display Air Quality Data Debbie Miller, National Park Service, Denver, CO

SAS/GRAPH and ANNOTATE Facility More Than Just a Bunch of Labels and Lines

Transcription:

PharmaSUG2010 - Paper TT16 Data Annotations in Clinical Trial Graphs Sudhir Singh, i3 Statprobe, Cary, NC ABSTRACT Graphical representation of clinical data is used for concise visual presentations of the results. SAS programmers are frequently asked to generate Kaplan-Meier plots, along with graphs of ECG, and clinical laboratory data. Although Kaplan- Meier plots are easily generated using PROC LIFETEST, reviewers often require additional information such as the number of patients at risk. The Annotate facility in SAS/GRAPH allows us to create customized modification to the graphics output. In this paper I will describe how to create annotations in Kaplan- Meier and line graphs from statistical procedures. Furthermore, these methods can be applied to annotations of other types of graphs. INTRODUCTION The Annotate facility in SAS/GRAPH is a very useful tool in enhancing or changing feature of your graphical output. Annotate gives you the flexibility to add any drawing object or text, in any format or color, to any place on your graphical output. With the help of examples I will explain how to generate Annotate datasets and produce customized graphics output. SURVIVAL ANALYSIS PLOTS Kaplan-Meier survival estimates created during time-to-event analyses are commonly used in clinical trials. The graphic presentation of survival analysis is a significant tool which facilitates clear understanding of the underlying events. Consider the following example dataset with subject identifier (SUBJID), time to progression in weeks (TIME_P, progressive disease (PD) and treatment group (Group) variables. The quick survival plot shown in figure 1 can be created and saved in an RTF file using the ODS RTF destination and the following Proc Lifetest code ODS RTF FILE='location\Pharmasuggraph.rtf' style=statistical; ODS LISTING CLOSE; ODS GRAPHICS on; Proc Lifetest data=all outsurv=ind1 method=km; Time time_p * pd (0); Run; ODS GRAPHICS OFF; ODS RTF CLOSE; ODS LISTING; QUIT; The ODS GRAPHICS ON statement will add statistical graphics to the output. Although plots are easily generated through PROC LIFETEST reviewers often require additional information such as number of patients at risk or log rank statistics to better interpret the Kaplan-Meier plots. The SAS Annotate facility allows us to create customized modifications to the graphics output. The Annotate facility is included within SAS/GRAPH and acts as a bridge between the procedure selected by the user and the user s desire to customize the graphics output. 1

FIGURE 1. Kaplan-Meier Survival Estimate Plot. ANNOTATE DATASET VARIABLES The first step is to create the Annotate dataset in order to use the Annotate facility of the SAS/GRAPH. The Annotate dataset is then fed to a SAS/GRAPH procedure and gets processed along with the SAS/GRAPH code. An Annotate dataset is similar to other SAS datasets but contains variable with predefined names. The Annotate variables tell Annotate what to do, how to do it, or where to do it. Below is a table defining some of the important variables that will be used in my examples. For a complete list of Annotate variables, refer to the SAS/GRAPH documentation. TABLE 1. Annotate Dataset Variables VARIABLE DESCRIPTION FUNCTION X Y HSYS XSYS YSYS LINE POSITION COLOR SIZE STYLE TEXT Specifies the Annotate drawing action. Table 2 below gives a list of important functions. The numeric horizontal coordinate The numeric vertical coordinate. The type of units for the size (height) variable. The coordinate system for the X variable. The coordinate system for the Y variable. Line type of graphics item. Placement/alignment of text. Color of graphics item Size of the graphics item. Specific to the function. For example, size is the height of the character for a label function. Font/pattern of a graphics item. Text to use in a label, symbol, or comment. 2

FUNCTIONS The Annotate dataset FUNCTION variables tell SAS what to do. The other variables all modify, specify or locate the function. Below is a table listing some of the functions that will be used in our example. For a complete list of Annotate functions, refer to the SAS/GRAPH documentation. TABLE 2. Functions FUNCTION LABEL MOVE DRAW COMMENT BAR SYMBOL DESCRIPTION Draws text. Moves to a specific point. Draws a line from the current position to a specified position. As a documentation aid, allows you to insert a comment into the SAS Annnotate file. Draws a rectangle from the current position to a specified position. Draws a symbol COORDINATE SYSTEMS The Annotate facility recognizes three different drawing areas, each with two possible unit types and the ability to designate these unit types as relative or absolute. These 12 conditions are coded as 1-9, A, B and C based on Figure 1 below. FIGURE 2. Areas and their coordinate systems. [1] The Data Area represents only the space within the graph axes. The second graph in the middle of figure 2 shows the Graphics Output Area which is the entire writable page of output. The bottom graph shows the Procedure Output Area or the area taken up by the graphic object. Once you have determined the appropriate coordinate system for each of your dimensions, you put the coded value in the XSYS and YSYS variables. 3

CREATING ANNOTATE DATASET The first step is to create an Annotate dataset for the labels in the KM graph. Consider the following code. DATA ANNO1; length function $8 text $100; retain xsys ysys '4' hsys '9' function 'label'; line=1; size=2.5; pos ition ='6'; x=1; y=4.0; text="number of Subjects at Risk" ; x=1;y=2.8; text="grp1"; The coordinate system selected for the x axis and y axis is 4. This corresponds (see Figure 1) to the Graphics output Area with absolute values. With this coordinate system you can use the actual values of the point of interest to place the label. Multiple variable assignments can be made in a single statement and multiple RETAIN statements are also permitted. The completed observation is written to the Annotate dataset through the use of the output statement. Each statement provides a value for an Annotate variable. After you have assigned all of the variables values for an observation, you must use an OUTPUT statement to write the observation to the dataset. The second step is to create the Annotate dataset for the number of subjects at risk. In order to get the number of subject at risk we need to do some data manipulation before creating the Annotate dataset. ****************************************************** To obtain Number of Subjects at Risk *****************************************************; *Step 1: Create frame dataset with all possible weeks within each group; *&xmax1 contains the maximum value of time_p; *&maxcol cotains maximum treatment group. In our example it is 1; data frame; do time_p = 0 to &xmax1; do group=1 to &maxcol; end; end; proc sort data=frame; by group descending time_p ; *** Step 2: Get subjects counts from SURVIVAL data at each time point; proc sort data=survival ; by group descending time_p pd; data count1; set survival; by group descending time_p pd; count+1; if first.group then count=1; if last.time_p then n=count; proc sort data=count1 out=count2; by group time_p n; where n; 4

proc sort data=count2(keep=group time_p n); by group descending time_p ; *** Merge frame and count2 dataset to get count at each time point; *** Retain value for previous missing values; Data count; merge frame count2; by group descending time_p; if first.group then last=0; if n=. then n=last; last=n; retain last; The COUNT dataset contains the number of subjects at each time point. Next the Annotate dataset is created using the following code. data anno2; length text $200 function $8; set %do i =0 %to &xmax1 %by 10; COUNT(where=(time_p=&i)) %end;; retain y ; function='label'; xsys='2'; ysys='4'; position='5'; size=1.0; if n ne. then text=trim(left(put(n,4.))); x=time_p; y=1.6;. Select the number of subjects at risk at every 10 weeks. We concatenate the two datasets to get the final Annotate dataset as data anno; set anno1 anno2; This will be our final Annotate dataset. We can now easily generate the graph using this Annotate dataset. PROC GPLOT is used to create the final plot shown in figure 3. GOPTIONS DEVICE=JPEG TARGETDEVICE =JPEG HSIZE=6 IN VSIZE=5 IN GSFNAME=graphs GSFMODE=REPLACE FTEXT="ARIAL" noborder ; title1 h=12pt j=c "Time to Progression Plot"; symbol1 line=1 color= blue width=1 interpol=stepjl v=none; symbol2 line=1 color= black width=1 interpol=none v=circle height=.8 ; axis1 order = (0 to &xmax1 by 10) label = (h = 1.2 "Time to Progression (weeks)") minor = (number = 3) offset = (0,0); axis2 order=(0 to 1 by.2) label = (h = 1.2 angle = 90 "Survival Probablity") minor = (number = 3) offset = (0,0); legend1 label=('') mode = share order = (1) position=(top RIGHT INSIDE) value=( " Censored values") down = 2 frame; 5

proc gplot data = plotdata ; plot survival*eftime_p =CENSOR/ haxis = axis1 vaxis = axis2 legend = legend1 noframe annotate=anno; quit; Notice the addition of the option Annotate=anno; to the plot statement. This allows the plot to incorporate the Annotate instructions found in the Annotate dataset. When a procedure uses an Annotate dataset it reads and interprets the observations one at a time, starting with the first observation and proceeding to the last. The order of the observations in the dataset determines the order in which the graphics elements are generated. If the coordinates of two graphics element overlap, the graphics element produced by an earlier observation can be overwritten by any graphics elements that are produced by subsequent observations. FIGURE 3. Annotated Kaplan-Meier Survival Estimate Plot. ECG GRAPHS Changes in ECG parameters like QRS, QT, and QTc are summarized over time in clinical trials. ECG graphs are generated to display 95% CI interval for Mean Change in ECG parameter and also number of subjects at risk. In the following I will explain how to annotate the line graph to display additional information. For the following example we have used a dataset with variables subject identifier (SUBJID), visit (VISITP), treatment group (TRT1PN) and change from baseline (CHG). 6

*** Compute CI for change from baseline; proc summary nway alpha=0.05 data=all; class trt1pn visitp; var chg; where visitp > 1; output out=stats mean(chg)=meanchg n = x lclm(chg)=lclmchg uclm(chg)=uclmchg; The confidence intervals and mean change from baseline are derived using PROC SUMMARY. The following Annotate dataset is created to annotate the ECG graph. *** Create Annotate dataset to draw labels; data anno1; length function $8 text $50; retain xsys ysys '4' function='label'; position='6'; size=1; x=1; y=6.6; text="no. of Subjects with ECG Parameter"; x=1; y=5.4; text="all subjects"; y=3.0; text="group 1"; *** Create Annotate dataset to draw vertical lines and symbols for CIs; data anno2; length color function text $ 8; set stats; if trt1pn=1 then text = 'dot'; else if trt1pn=2 then text = 'circle'; else text = 'diamond'; if lclmchg >.Z and uclmchg >.Z then do; function='move'; xsys='2'; ysys='2'; x=visitp; y=meanchg; function='draw'; xsys='2'; ysys='2'; x=visitp; y=uclmchg; line=1; size=1; function='symbol'; xsys='2'; ysys='2'; x=visitp; y=uclmchg; line=1; size=.8; function='move'; xsys='2'; ysys='2'; x=visitp; y=meanchg; color=''; line=.; size=.; function='draw'; xsys='2'; ysys='2'; x=visitp; y=lclmchg; line=1; size=1; function='symbol'; xsys='2'; ysys='2 '; x=visitp; y=lclmchg; line=1; size=.8; end; The coordinate system selected for the x axis and y axis is 2. This corresponds (see Figure 1) to the Data Area with absolute values. ***create the number of subjects with lab values over time on the x-axis per group***; data frame1; do trt1pn=1, 3; do visitp = 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 26; count = 0; end; end; format trt1pn trtft.; 7

proc sort data=all ; by trt1pn visitp; data time_p_n1 (keep=trt1pn visitp count); set ecgdataset; by trt1pn visitp; if first.visitp then count=0; count+1; if last.visitp and count >. then *** Retain value for previous missing values ; data time_p_n; merge frame1 (in=inf) time_p_n1; by trt1pn visitp; if inf; data anno3; length text $200 function $8; set time_p_n (where=(trt1pn >.Z)); retain y xsys '2' ysys '4' function='label'; position='5'; size=1.0; if count >.Z then text=trim(put(count, 2.)); x=visitp; if trt1pn=1 then y = 4.2; else if trt1pn=3 then y = 1.8; data anno; set anno1 anno2 anno3; Anno is the final Annotate dataset. PROC GPLOT is used to create the final plot shown in figure 4. Axis1, Axis2 and Legend1 are defined in the program but not shown here. proc gplot data = stats annotate=anno; plot meanchg * visitp = trt1pn/ haxis = axis1 vaxis = axis2 legend = legend1 href = 24 lhref=3 /* dotted vertical reference line at Month 24 */ noframe; quit; 8

FIGURE 4. Annotated ECG Graph. CONCLUSION Annotate is a powerful, flexible tool that allows you to draw any text or object on any graphical output. This paper has explained some of the Annotate facility with the help of examples in clinical trials. Applying this to selected situations enables the reviewers of the graphs to gather more precision around the visual representation of the results. REFERENCES 1. SAS Institute, Inc (2004) SAS/Graph 9.1 Reference, Volumes I and II, Cary,NC:SAS Institute, Inc. 2. Smoak C, Survival (Kaplan-Meier) Curves Made Easy, PharmaSUG, 2006. 3. Carpenter Al, Data Driven Annotation: An Introduction to SAS/Graph s Annotate Facility, PharmaSUG,2006. 4. Christ-Schmidt H, Downs M. A SAS Macro to Generate Enhanced Kaplan-Meier Plots. Proceedings of the Thirtieth SAS User Group International, April, 2005. 5. Mink D, Pasta J. Improving Your Graphics Using SAS/GRAPH Annotate Facility SUGI, 2006. ACKNOWLEDGMENTS I would like to thank Nancy Brucken, Mark Matthews, Gokul Shankar and Steven Hege for guiding this work and carefully reviewing the paper with comments and suggestions. 9

CONTACT INFORMATION Your comments and questions are valued and appreciated. The author can be reached at: Sudhir Singh i3 Statprobe 1001 Winstead Drive, Suite 200 Cary,NC 27513 U.S.A Email : sudhir.singh2@i3statprobe.com 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. 10