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

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

Creating Forest Plots Using SAS/GRAPH and the Annotate Facility

Clip Extreme Values for a More Readable Box Plot Mary Rose Sibayan, PPD, Manila, Philippines Thea Arianna Valerio, PPD, Manila, Philippines

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

A Generalized Procedure to Create SAS /Graph Error Bar Plots

Multiple Forest Plots and the SAS System

PharmaSUG 2012 Paper CC13

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

THE IMPACT OF DATA VISUALIZATION IN A STUDY OF CHRONIC DISEASE

Create Flowcharts Using Annotate Facility. Priya Saradha & Gurubaran Veeravel

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

INTRODUCTION TO THE SAS ANNOTATE FACILITY

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

DAY 52 BOX-AND-WHISKER

Coders' Corner. Paper ABSTRACT GLOBAL STATEMENTS INTRODUCTION

Understanding and Comparing Distributions. Chapter 4

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

Chapter 5. Understanding and Comparing Distributions. Copyright 2012, 2008, 2005 Pearson Education, Inc.

STA Module 2B Organizing Data and Comparing Distributions (Part II)

STA Learning Objectives. Learning Objectives (cont.) Module 2B Organizing Data and Comparing Distributions (Part II)

Using PROC SQL to Generate Shift Tables More Efficiently

Chapter 5. Understanding and Comparing Distributions. Copyright 2010, 2007, 2004 Pearson Education, Inc.

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

Let Hash SUMINC Count For You Joseph Hinson, Accenture Life Sciences, Berwyn, PA, USA

PharmaSUG 2015 Paper PO03

Keeping Track of Database Changes During Database Lock

STA 570 Spring Lecture 5 Tuesday, Feb 1

STA Rev. F Learning Objectives. Learning Objectives (Cont.) Module 3 Descriptive Measures

How to annotate graphics

Run your reports through that last loop to standardize the presentation attributes

Boxplots. Lecture 17 Section Robb T. Koether. Hampden-Sydney College. Wed, Feb 10, 2010

Chapter 3 - Displaying and Summarizing Quantitative Data

Paper S Data Presentation 101: An Analyst s Perspective

STP 226 ELEMENTARY STATISTICS NOTES PART 2 - DESCRIPTIVE STATISTICS CHAPTER 3 DESCRIPTIVE MEASURES

USING SAS PROC GREPLAY WITH ANNOTATE DATA SETS FOR EFFECTIVE MULTI-PANEL GRAPHICS Walter T. Morgan, R. J. Reynolds Tobacco Company ABSTRACT

Boxplot

NCSS Statistical Software

Math 167 Pre-Statistics. Chapter 4 Summarizing Data Numerically Section 3 Boxplots

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

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

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

To calculate the arithmetic mean, sum all the values and divide by n (equivalently, multiple 1/n): 1 n. = 29 years.

Chapter 2 Exploring Data with Graphs and Numerical Summaries

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

Creating a Box-and-Whisker Graph in Excel: Step One: Step Two:

3.3 The Five-Number Summary Boxplots

Behind the Scenes: from Data to Customized Swimmer Plots Using SAS Graph Template Language (GTL)

SAS CLINICAL SYLLABUS. DURATION: - 60 Hours

CFB: A Programming Pattern for Creating Change from Baseline Datasets Lei Zhang, Celgene Corporation, Summit, NJ

When comparing in different sets of, the deviations should be compared only if the two sets of data use the

SAS Graph: Introduction to the World of Boxplots Brian Spruell, Constella Group LLC, Durham, NC

Generating Participant Specific Figures Using SAS Graphic Procedures Carry Croghan and Marsha Morgan, EPA, Research Triangle Park, NC

There s No Such Thing as Normal Clinical Trials Data, or Is There? Daphne Ewing, Octagon Research Solutions, Inc., Wayne, PA

The Plot Thickens from PLOT to GPLOT

Univariate Statistics Summary

Innovative Graph for Comparing Central Tendencies and Spread at a Glance

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

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

Descriptive Statistics: Box Plot

Creating output datasets using SQL (Structured Query Language) only Andrii Stakhniv, Experis Clinical, Ukraine

Sorting big datasets. Do we really need it? Daniil Shliakhov, Experis Clinical, Kharkiv, Ukraine

Creating Maps in SAS/GRAPH

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

MICROSOFT EXCEL Working with Charts

BUSINESS ANALYTICS. 96 HOURS Practical Learning. DexLab Certified. Training Module. Gurgaon (Head Office)

A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY

Amie Bissonett, inventiv Health Clinical, Minneapolis, MN

Displaying Multiple Graphs to Quickly Assess Patient Data Trends

Creating Complex Graphics for Survival Analyses with the SAS System

SAS (Statistical Analysis Software/System)

Numerical Summaries of Data Section 14.3

Middle Years Data Analysis Display Methods

1.3 Graphical Summaries of Data

SAS (Statistical Analysis Software/System)

CHAPTER 1. Introduction. Statistics: Statistics is the science of collecting, organizing, analyzing, presenting and interpreting data.

UNIVERSITY OF BAHRAIN COLLEGE OF APPLIED STUDIES STATA231 LAB 4. Creating A boxplot Or whisker diagram

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

Chapter 2 Describing, Exploring, and Comparing Data

186 Statistics, Data Analysis and Modeling. Proceedings of MWSUG '95

Post-Processing.LST files to get what you want

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

One Project, Two Teams: The Unblind Leading the Blind

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

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

Reverse-engineer a Reference Curve: Capturing Tabular Data from Graphical Output Brian Fairfield-Carter, ICON Clinical Research, Redwood City, CA

separate representations of data.

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

NAME: DIRECTIONS FOR THE ROUGH DRAFT OF THE BOX-AND WHISKER PLOT

15 Wyner Statistics Fall 2013

SAS Training BASE SAS CONCEPTS BASE SAS:

Using ANNOTATE MACROS as Shortcuts

CHAPTER 3: Data Description

MATH& 146 Lesson 10. Section 1.6 Graphing Numerical Data

An Introduction to Visit Window Challenges and Solutions

Bar Graphs with Two Grouping Variables 1

Measures of Position. 1. Determine which student did better

Lecture Notes 3: Data summarization

Get SAS sy with PROC SQL Amie Bissonett, Pharmanet/i3, Minneapolis, MN

%Addval: A SAS Macro Which Completes the Cartesian Product of Dataset Observations for All Values of a Selected Set of Variables

Statistics and Data Analysis. Common Pitfalls in SAS Statistical Analysis Macros in a Mass Production Environment

Transcription:

Taming the Box Plot Sanjiv Ramalingam, Octagon Research Solutions, Inc., Wayne, PA ABSTRACT Box plots are used to portray the range, quartiles and outliers if any in the data. PROC BOXPLOT can be used to obtain the necessary graphic but certain situations may arise where direct application of the procedure and use of the plethora of options that come along with it may not be sufficient to get the desired graph. One such application is discussed in detail. This should empower the reader upon understanding to create any box plot that the reader may wish. The methodology discussed assumes that the reader has at least a modicum of understanding of the annotate feature. INTRODUCTION In performing a clinical trial the primary objective is to test the safety and efficacy of a drug. This process involves comparing the drug of interest with a placebo and/or already existing drugs in the market. For a number of clinical tests that are performed it is desired to have a graphical summary of both the central tendency and variation in that clinical test. The boxplot is the desired graphic to portray the range and the quartiles of the data and possibly some outliers. There is no direct approach to present box plots when all of the following tasks have to be implemented: (A) Multiple treatments have to be presented for multiple visits with a box plot for each treatment per visit. (B) The medians or any statistical parameter for each of the treatments have to be connected by separate lines. (C) The counts (number of subjects) for each of the treatments per visit are to be displayed. Assuming that there are a number of visits to be displayed on a single page, a large number of visits necessitate the counts to be displayed on a slant with counts for each treatment on a separate line. A step-by-step procedure is described below to create the boxplot described above. It is assumed that there are two treatments involved, namely Drug A and Placebo. METHODOLOGY Step 1 The visits involved in the box plot are re-assigned if necessary so that they are in a sequential order represented by smaller integers such as 0, 2, 4, 6, 8, 10, 12, etc., if originally the visit numbers were represented as 100, 200, 700, and so forth. The visits for one of the treatments and in this example for DrugA are shifted by a small numerical value (0.5). Let this dataset be datax with parameter results under the variable name aval. Step 2 The counts for each treatment per visit are obtained using PROC FREQ between the treatment and visits. The counts are then converted to macro variables. There are N number of ways of reaching a solution the following approach was taken so as to create an array of macro variables that will be used in a PROC FORMAT. 1

Two datasets (DrugA and Placebo), containing records only for that treatment, are created using the output statements from the output of the PROC FREQ procedure. Macro variables (nobs_a, nobs_pl) are created to represent the total number of observations in each of the datasets, DrugA and Placebo. The following code accomplishes this task. data _null_ set DrugA end=eof if eof then call symput('nobs_a',trim(left(input(_n_,best12.)))) run data _null_ set Placebo end=eof if eof then call symput('nobs_pl',trim(left(input(_n_,best12.)))) run Using PROC SQL and into: statements, an array of macro variables is created as shown below. proc sql noprint select drugacnt into :drugacnt1 -:drugacnt&&nobs_a from DrugA select plcount into :plcnt1 -:plcnt&&nobs_pl from Placebo quit Step 3 Formats are now assigned so that the counts can be displayed. picture trtoth 0.5=" " 1.5=" " 2.5=" "... value cnts 0="Baseline,(N2=&plcnt1/N1=&drugAcnt1)" 1="Month 3,(N2=&plcnt2/N1=&drugAcnt2)" 2="Month 6,(N2=&plcnt3/N1=&drugAcnt3)"... other=[trtoth.] 2

The concept for the counts to be displayed on a slant with counts of each treatment on a separate line can be implemented using the annotate feature [1]. In this annotate dataset a different coordinate system, i.e. the procedure output area is used, unlike the data area that is used in the next step. Step 4 The medians associated with each of the treatments are obtained using PROC MEANS. The structure of the Median dataset will be as follows: TRT TRTN VISITN MEDIAN DrugA 1 0 XX DrugA 1 2 XX DrugA 1 4 XX Placebo 2 0 XX Placebo 2 2 XX The next step involves connecting the median from one visit to the next visit which is achieved using the annotate feature. The resulting annotate dataset is named anno1. Part of the implementation involves automatically assigning the move and draw functions. A. In the first step the parameters for the annotate data set are set for all records. Line=20 assigns a dashed line. The dashed line is preferred for placebo and a solid line(line=1) is assigned to DrugA, which however is assigned later. Only the data area will be used and hence XSYS and YSYS are set to 2. The when option is set to a so that lines are drawn after the figure is plotted. Function= move is assigned to all records. B. All records are output and the output statement is used again when the visit is not equal to the initial visit (visitn=0). The output dataset will be similar to the structure below. TRTN VISITN MEDIAN FUNCTION COLOR XSYS YSYS WHEN LINE 1 0 2.1 move black 2 2 a 20 1 1 4.2 move black 2 2 a 20 1 1 4.2 move black 2 2 a 20 1 2 3.1 move black 2 2 a 20 1 2 3.1 move black 2 2 a 20 C. The above dataset is sorted by treatment and visit. Using the FIRST. and LAST. option the last unique visit but with visit not equal to the initial visit(visitn=0) is assigned a move function and the first unique visit but with visit not equal to the initial visit is assigned a draw function. The last record with the function move is deleted as it is not required. The contents of the dataset will then be similar to the dataset below. 3

TRTN VISITN MEDIAN FUNCTION COLOR XSYS YSYS WHEN LINE 1 0 2.1 move black 2 2 a 20 1 1 4.2 draw black 2 2 a 20 1 1 4.2 move black 2 2 a 20 1 2 3.1 draw black 2 2 a 20 1 2 3.1 move black 2 2 a 20 Step 5 As part of the annotate dataset the legend is also constructed using the text, move and draw statements. length function $8 text $100 retain xsys ysys '2' style '' when 'a' size 1 function='label' text=" Median,N2= Placebo" x=xx y=yy color='black' output function='label' text=" Median,N1= DrugA" x=xx y=yy color='black' output function='move' x=x1 y=y1 output function='draw' x=x2 y=y1 line=1 output function='draw' x=x2 y=y2 line=1 output function='draw' x=x1 y=y2 line=1 output function='draw' x=x1 y=y1 line=1 output Step 6 Since the legend has been created using the annotate feature the default legend that appears should be prevented from appearing. The following options are used in the legend statement to ensure that the default legend is invisible. One of the key options is the shape option. Shape can either be LINE or SYMBOL. The LINE option with a minimal value of 1 is chosen as this option omits the symbols[2]. legend1 down=4 label=(justify=l ' ')position=(bottom center outside ) value=(color=white) shape=line(1) 4

Step 7 Assign formats so that for each visit, the treatments, DrugA and Placebo are represented as N1 and N2 respectively. value vst 0="N2" 0.5="N1" 1="N2" 1.5="N1"... Step 8 The desired graphic can now be created using PROC BOXPLOT. The following options should be used. boxstyle=schematic <To draw whiskers from the outer edge of the box to the highest value within the upper fence and lower edge to smallest value within lower fence> idsymbol=dot <Symbol to denote outliers> cboxfill=white <Specifies the interior fill colors for the box and whisker plot> cboxes=black <Color for outline of box and whisker plot> nohlabel <To suppress the label for the horizontal axis> Symbols (symbol1 and symbol2) are used to denote the symbol to be used to represent the means for each of the treatments. symbol1 value=plus color=black symbol2 value=plus color=black axis1 minor=none color=black label=(angle=90"parameterx") order=(0 to 1000 by 250) proc boxplot data=datax plot aval*visitn=trtn/anno=anno1 boxstyle=schematic idsymbol=dot cboxfill=white cboxes=black nohlabel symbollegend=legend1 vaxis=axis1 format visitn vst. label visitn=" " trtn=" " run 5

The final figure will then be similar to the figure below. CONCLUSION A methodology has been shown that maximizes the use of the PROC BOXPLOT procedure. An understanding of this methodology should enable the reader to manipulate the box plot in many other ways. REFERENCES 1. Rick Edwards, It s Not All Relative:SAS/Graph Annotate Coordinate Systems. PHARMASUG 2007. 2. Wendi L. Wright, A Legend is Not Just a Legend, SAS Global Forum 2007. 6

CONTACT INFORMATION Your comments and questions are valued and encouraged. Please contact the author at: Sanjiv Ramalingam Octagon Research Solutions, Inc. 585 E Swedesforde Road Wayne, PA 19087 Email : sramalingam@octagonresearch.com 7