A Generalized Procedure to Create SAS /Graph Error Bar Plots

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

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

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

PharmaSUG 2012 Paper CC13

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

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

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

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

Tips and Tricks in Creating Graphs Using PROC GPLOT

INTRODUCTION TO THE SAS ANNOTATE FACILITY

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

Creating Forest Plots Using SAS/GRAPH and the Annotate Facility

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

Graphical Techniques for Displaying Multivariate Data

Coders' Corner. Paper ABSTRACT GLOBAL STATEMENTS INTRODUCTION

The Plot Thickens from PLOT to GPLOT

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

THE IMPACT OF DATA VISUALIZATION IN A STUDY OF CHRONIC DISEASE

Create Flowcharts Using Annotate Facility. Priya Saradha & Gurubaran Veeravel

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

ABSTRACT. The SAS/Graph Scatterplot Object. Introduction

A Juxtaposition of Tables and Graphs Using SAS /GRAPH Procedures

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

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 a Picture Format to Create Visit Windows

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

Amie Bissonett, inventiv Health Clinical, Minneapolis, MN

EXCEL SKILLS. Selecting Cells: Step 1: Click and drag to select the cells you want.

Applied Regression Modeling: A Business Approach

ODS LAYOUT is Like an Onion

IMPROVING A GRAPH USING PROC GPLOT AND THE GOPTIONS STATEMENT

Using SAS Macro to Include Statistics Output in Clinical Trial Summary Table

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

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

Innovative Graph for Comparing Central Tendencies and Spread at a Glance

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

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

Using MACRO and SAS/GRAPH to Efficiently Assess Distributions. Paul Walker, Capital One

Paper SIB-096. Richard A. DeVenezia, Independent Consultant, Remsen, NY

Paper An Automated Reporting Macro to Create Cell Index An Enhanced Revisit. Shi-Tao Yeh, GlaxoSmithKline, King of Prussia, PA

The Power of Combining Data with the PROC SQL

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

Activity: page 1/10 Introduction to Excel. Getting Started

CHAPTER 6. The Normal Probability Distribution

Please Don't Lag Behind LAG!

And Now, Presenting... Presentation Quality Forecast Visualization with SAS/GRAPH Samuel T. Croker, Independent Consultant, Lexington, SC

Organizing and Summarizing Data

Want Quick Results? An Introduction to SAS/GRAPH Software. Arthur L. Carpenter California Occidental Consultants

CREATING THE DISTRIBUTION ANALYSIS

Arthur L. Carpenter California Occidental Consultants

Taming a Spreadsheet Importation Monster

Bar Graphs with Two Grouping Variables 1

PharmaSUG China. Systematically Reordering Axis Major Tick Values in SAS Graph Brian Shen, PPDI, ShangHai

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

PharmaSUG China Paper 70

separate representations of data.

SparkLines Using SAS and JMP

A Practical and Efficient Approach in Generating AE (Adverse Events) Tables within a Clinical Study Environment

So Much Data, So Little Time: Splitting Datasets For More Efficient Run Times and Meeting FDA Submission Guidelines

Statistics and Data Analysis. Paper

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

Microsoft Excel 2007

Submitting SAS Code On The Side

Displaying Multiple Graphs to Quickly Assess Patient Data Trends

Create a Format from a SAS Data Set Ruth Marisol Rivera, i3 Statprobe, Mexico City, Mexico

Contents of SAS Programming Techniques

Easing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide

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

MICROSOFT EXCEL Working with Charts

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

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

PharmaSUG 2015 Paper PO03

Modifying Graphics in SAS

Gloucester County Library System EXCEL 2007

Teaching statistics and the SAS System

SAS Macros for Grouping Count and Its Application to Enhance Your Reports

Lab #9: ANOVA and TUKEY tests

Keeping Track of Database Changes During Database Lock

Robust Linear Regression (Passing- Bablok Median-Slope)

The GTESTIT Procedure

Getting it Done with PROC TABULATE

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

Using SAS/GRAPH Software to Create Graphs on the Web Himesh Patel, SAS Institute Inc., Cary, NC Revised by David Caira, SAS Institute Inc.

Are you Still Afraid of Using Arrays? Let s Explore their Advantages

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

Breaking up (Axes) Isn t Hard to Do: An Updated Macro for Choosing Axis Breaks

A Strip Plot Gets Jittered into a Beeswarm

Data Edit-checks Integration using ODS Tagset Niraj J. Pandya, Element Technologies Inc., NJ Vinodh Paida, Impressive Systems Inc.

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

Compute; Your Future with Proc Report

Microsoft Office Excel

Out of Control! A SAS Macro to Recalculate QC Statistics

Internet, Intranets, and The Web

Chapter 3 - Displaying and Summarizing Quantitative Data

Multiple Forest Plots and the SAS System

Correcting for natural time lag bias in non-participants in pre-post intervention evaluation studies

PROC FORMAT: USE OF THE CNTLIN OPTION FOR EFFICIENT PROGRAMMING

Using PROC SQL to Generate Shift Tables More Efficiently

Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC

Tips and Techniques for Designing the Perfect Layout with SAS Visual Analytics

Transcription:

Generalized Procedure to Create SS /Graph Error Bar Plots Sanjiv Ramalingam, Consultant, Octagon Research Solutions, Inc. BSTRCT Different methodologies exist to create error bar related plots. Procedures exist to use the dataset by itself to create error bars either for standard deviation +/- mean (INTERPOLTION=STD1JT), standard errors +/- mean (INTERPOLTION= STD1TJM) or min and max values but it becomes cumbersome to generate figures by just using the PROC PLOT procedure as one has to go through numerous options available to find the right option. This paper discusses a methodology to plot the difference between the means with the standard error as an example. INTRODUCTION typical scenario involving error bars is to obtain standard errors. If the error bars are obtained as the standard errors of not one treatment (as related to the pharmaceutical industry) but as the difference of two different treatments it is always advantageous to have a general process. In this process, the PROC MENS/UNIVRITE procedure can be used to calculate the statistics and a separate data step can be used to calculate the derived statistics such as the standard error for two different treatments. Then one generalized plot procedure can be used to create the error bar plot. METHODOLOGY CSE 1 The concept is based on the assumption that all values required to create the graph are already available in the form of a dataset. Let the first objective be to create a standard error plot for the difference between two different treatments by visit. The parameters required are the means for each of the treatments (the difference of the means is then computed). The standard error of the difference of the means is computed using the formula: σdiff=sqrt[(σtrt1^2/ntrt1) + (σtrt2^2/ntrt2)] where, σdiff = standard error of the difference 1

σtrt1^2= variance of first treatment (square of the standard deviation) σtrt2^2= variance of second treatment ntrt1=number of subjects in the first treatment ntrt2=number of subjects in the second treatment fter the means for each of the treatments have been computed, the following can be computed using the sample code statements namely, the difference of the means(d_mean), the standard error (SE) of the difference of the means (d_se_m), the maximum(maxm;mean+se) and minimum(minm;mean-se). d_mean=trt1_ - trt2_mean; d_se_m=sqrt( ((se_trt1*se_trt1)/n_trt1) +((se_trt2*se_trt2)/n_trt2)) ; maxm= d_mean + d_se_m; minm= d_mean - d_se_m ; The output dataset created namely, DS1 would then have a structure like the one below. VISIT D_MEN MXM MINM Week 2 Week 3. The statistical parameters are now available. Since the error bars basically are two points with a common reference point, the HILOCTJ option in SS/Graph can be used. However to use the HILOCTJ option which basically draws a solid vertical line that connects the minimum and maximum Y values for each X value, the dataset should have individual records for each of the 2

maxm and minm variables. Hence a PROC TRNSPOSE can be done on the variables maxm and minm in the dataset DS1: proc transpose data=ds1 out=ds2; by visit ; var d_mean minm maxm; The resulting dataset will be of the structure: VISIT _NME_ COL1 MINM Week 2 Week 2 Week 2... D_MEN MXM MINM D_MEN MXM To automatically assign the range for the Y-axis and also the number of divisions within each unit the dataset can be sorted by the col1 variable. The first and last values would then be the minimum and the maximum values. The difference between the maximum and the minimum divided by 10 (assuming that 10 divisions are preferred within each unit) rounded to the nearest preferred number of decimal places will yield the number of subdivisions (referred by the variable orderby). ll the above parameters (minimum(mino), maximum(maxo) and orderby) would be the inputs to the order option in the XIS statement. lternatively, the standard deviation can be used to determine the number of subdivisions within each unit. Ensure that the dataset is sorted back to its original order by visit. The above-described procedure can be implemented in code as shown below. 3

proc sort data=ds2; by col1; /* Create macro variables that serve as parameters in the order statement for vertical axis */ data ds2; retain mintemp; set ds2 end=eof; if _n_ eq 1 then mintemp=col1; if eof then do; maxtemp=col1; orderby_=round(((maxtemp - mintemp)/10),0.1); if orderby_ eq 0 then orderby_=round(((maxtemp-mintemp)/10),0.01); temp1=round(maxtemp+orderby_,0.1); if mintemp gt 0 then temp2=round(mintemp-orderby_,0.01); else temp2=mintemp-orderby_; if temp1 gt temp2 then do; call symput('mino', put(temp2, best12.)); call symput ('maxo', put(temp1, best12.)); end; else do; call symput('mino', put(temp1, best12.)); call symput ('maxo', put(temp2, best12.)); end; call symput ('orderby', put(orderby_, best12.)); end; proc sort data=ds2; by visit; 4

The plot procedure can now be implemented. Keeping in mind the objective of obtaining a generalized procedure to create error bar related graphs, less importance has been given to the plethora of options that come along with the GOPTIONS, SYMBOL, XIS and other statements. symbol1 v=star c=black i=hiloctj mode=include ; proc gplot data=ds2; /* Symbol1 represents the symbol used to represent the data points mode=include; specifies SS to use all the values in the dataset v=symbol to be used; I represents the interpolation method and hiloctj connects the lower and upper error bar with a straight line and also connects each of the means with a straight line; c=color */ /*axis 1 refers to the vertical axis */ axis1 label=(angle=90 'Parameter') order=(&mino. to &maxo. by &orderby.) width=1 offset=(0,0); /*axis 2 refers to the horizontal axis */ axis2 label=( 'Visits'); /* plot values. vref basically draws a reference line at Y value=0,color is black and lvref=20 draws a dotted line. The different patterns available can be obtained from the statgraph subsection of the support section in SS. */ plot col1*visit/ vref=0 cvref=black lvref=20 haxis=axis2 vaxis=axis1 ; quit; 5

The graph should be similar to Figure 1. Figure 1. n example of a standard error of the difference of the means between two treatments. CSE 2 The same technique can be used to create a standard error bar for comparing different treatments against two parameters. Let there be two treatments of interest ( and B) and let the parameters to be compared be X and Y. We now want to compare the change from baseline(chg) for these two parameters side by side for both the treatments ( and B). fter the means for each of the parameters within each of the treatments are obtained using the PROC MENS procedure, the output dataset is then transposed twice with the transpose variables being mean, min(meanstandard error) and max(mean+standard error). The two transposed datasets are then merged. The merged dataset(ds2) should be of the structure as described below. 6

MEN_X MIN_X MX_X MEN_Y MIN_Y MX_Y Week 2 MEN_X.. B MEN_X. The error bars can then be plotted using PROC GPLOT. /* Two legend statements are used one for each of the plot statements for each of the parameters X and Y. The down option is used so that each of the legend values appear one below the other. Down=2 allocates two rows. */ legend1 label=(justify=left 'Treatment:') down=2 position=(top center outside) value=(tick=1 justify=left "; X" tick=2 justify=left "B; X"); legend2 label=(justify=left ' ') down=2 position=(top center outside) value=( tick=1 justify=left "; Y" tick=2 justify=left "B; Y"); 7

proc gplot data=ds2 ; /* There are four symbols used, a pair(for each treatment arms and B) for each of the parameters X and Y.*/ symbol1 v=star c=black i=hiloctj mode=include ; symbol2 v=plus height=1 i=hiloctj c=black mode=include; symbol3 v=circle height=1 i=hiloctj c=black mode=include; symbol4 v=dot height=1 i=hiloctj c=black mode=include; /* X-xis */ axis1 label=( 'Visit') order=(0 to 6 by 1) minor=none major=none; /* Vertical axis for parameter X */ axis2 split="," label=(angle=90 'Change from Baseline in X') order=( to yy by z) minor=none ; /* Vertical axis for parameter Y */ axis3 split="," label=(angle=90 'Change from Baseline in Y') order=( to yy by z) minor=none ; /* Two plot statements are used, one for each parameter */ plot X*visitn=trt/haxis=axis1 vaxis=axis2 legend=legend1 ; plot2 Y*visitn=trt/ vaxis=axis3 legend=legend2 ; quit; The graph output should be similar in structure to Figure 2. Figure 2. n example of mean and standard error between two treatments( and B) for two different parameters(x and Y) 8

It can be noticed that the spacing between intervals along the x- axis is not equal and reflects true intervals. This can be achieved using proc format and using the picture format for visits that are not represented. proc format; picture trtoth 4=" " 6=" " ; value visit 1="" 2="Week 2" 3="Week 3" 5="Week 5" other=[trtoth.] ; lso there is a slight shift between the error bars for each of the parameters. This is done so that the error bars within each parameter do not overlap and can be visualized better and is achieved by adding a small numerical value (0.04 etc) to the visit (numeric attribute) for one of the treatment arms [1]. CONCLUSION methodology has been shown that can easily create error bar plots and similar graphs. The above code can be made into a macro as the most essential things required are a statistical procedure, a transpose procedure and a very simple plot procedure. CKNOWLEDGEMENTS I would like to thank my colleagues at Octagon Research Solutions for their encouragement and support especially my director Terek Peterson, my project manager Brian Shilling, Katie Mao for 9

independently implementing the technique, Frank Canale for his suggestions and to llan Glaser for critiquing the paper. I would also like to thank MCS GLOBL Inc for their support. COPYRIGHT SS and all other SS Institute Inc. product or service names are registered trademarks or trademarks of SS Institute Inc. in the United States of merica and other countries. indicates US registration. Other brand or product names are registered trademarks or trademarks of their respective companies. REFERENCE 1. Qin, Lin. NESUG 2007 Tips and Tricks in Creating Graphs Using PROC GPLOT, pplied clinical Intelligence LLC, SS online Document for Version 9. SS Institute Inc. Cary, NC. uthor contact Sanjiv Ramalingam Consultant (MCS GLOBL Inc.) Octagon Research Solutions Wayne, P-19087 r.sanjiv@yahoo.com 10