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

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

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

PharmaSUG 2012 Paper CC13

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

Creating Forest Plots Using SAS/GRAPH and the Annotate Facility

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

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

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

INTRODUCTION TO THE SAS ANNOTATE FACILITY

THE IMPACT OF DATA VISUALIZATION IN A STUDY OF CHRONIC DISEASE

Multiple Forest Plots and the SAS System

Create Flowcharts Using Annotate Facility. Priya Saradha & Gurubaran Veeravel

Coders' Corner. Paper ABSTRACT GLOBAL STATEMENTS INTRODUCTION

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

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

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

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

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

Keeping Track of Database Changes During Database Lock

Tips and Tricks in Creating Graphs Using PROC GPLOT

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

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

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

JMP Clinical. Release Notes. Version 5.0

How to annotate graphics

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

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

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

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

Compute; Your Future with Proc Report

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

Amie Bissonett, inventiv Health Clinical, Minneapolis, MN

SAS CLINICAL SYLLABUS. DURATION: - 60 Hours

ODS/RTF Pagination Revisit

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

A Juxtaposition of Tables and Graphs Using SAS /GRAPH Procedures

Fly over, drill down, and explore

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

Innovative Graph for Comparing Central Tendencies and Spread at a Glance

Patient-Level Longitudinal Analysis Plots Showing Adverse Event Timelines and Dose Titration Levels

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

Paper S Data Presentation 101: An Analyst s Perspective

Indenting with Style

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

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

Streamline Table Lookup by Embedding HASH in FCMP Qing Liu, Eli Lilly & Company, Shanghai, China

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

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

A Tool to Compare Different Data Transfers Jun Wang, FMD K&L, Inc., Nanjing, China

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

ODS LAYOUT is Like an Onion

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

Displaying Multiple Graphs to Quickly Assess Patient Data Trends

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

ABSTRACT INTRODUCTION SESUG RV

PharmaSUG 2015 Paper PO03

Regaining Some Control Over ODS RTF Pagination When Using Proc Report Gary E. Moore, Moore Computing Services, Inc., Little Rock, Arkansas

PharmaSUG Paper AD21

Presentation Quality Graphics with SAS/GRAPH

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

Get Started Writing SAS Macros Luisa Hartman, Jane Liao, Merck Sharp & Dohme Corp.

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

PharmaSUG Paper TT11

Using PROC SQL to Generate Shift Tables More Efficiently

PharmaSUG China Paper 059

CONSORT Diagrams with SG Procedures

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

Arthur L. Carpenter California Occidental Consultants, Oceanside, California

IT S THE LINES PER PAGE THAT COUNTS Jonathan Squire, C2RA, Cambridge, MA Johnny Tai, Comsys, Portage, MI

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

A Mass Symphony: Directing the Program Logs, Lists, and Outputs

ABC s of Graphs in Version 8 Caroline Bahler, Meridian Software, Inc.

The GANNO Procedure. Overview CHAPTER 12

Bad Date: How to find true love with Partial Dates! Namrata Pokhrel, Accenture Life Sciences, Berwyn, PA

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

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

SparkLines Using SAS and JMP

Automate Clinical Trial Data Issue Checking and Tracking

The GSLIDE Procedure. Overview. About Text Slides CHAPTER 27

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

Creating Complex Graphics for Survival Analyses with the SAS System

separate representations of data.

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

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

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

Creating and Customizing Graphics using Graph Template Language

A Few Quick and Efficient Ways to Compare Data

PharmaSUG China

This paper describes a report layout for reporting adverse events by study consumption pattern and explains its programming aspects.

2 = Disagree 3 = Neutral 4 = Agree 5 = Strongly Agree. Disagree

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

Converting Annotate to ODS Graphics. Is It Possible?

Using ANNOTATE MACROS as Shortcuts

A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA

Real Time Clinical Trial Oversight with SAS

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

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

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

Making a List, Checking it Twice (Part 1): Techniques for Specifying and Validating Analysis Datasets

Transcription:

Abstract PharmaSUG 2011 - Paper TT10 Creating a Customized Graph for Adverse Event Incidence and Duration Sanjiv Ramalingam, Octagon Research Solutions Inc. Adverse event (AE) analysis is a critical part of clinical trial data analysis, and is commonly handled through conventional summary tables and listings. However, presenting adverse event information graphically at the individual subject level may help the clinician visualize the assessment of safety, emphasize the adverse events of special interest, and compare the adverse events between treatments and subjects. A very robust technique to create such a graph using the annotate feature is discussed. The technique also involves dynamically creating SAS statements using PROC SQL and SAS Macro. Introduction The graph illustrates all the subjects that had a particular adverse event. Subjects identifiers are listed on the vertical axis with days on study drug in the horizontal axis. The distance between two connected symbols determines the duration of the AE. Dashed lines indicate that the AE was not treatment emergent. The graph of interest is illustrated below: 1

Core Technique One of the techniques incorporated involves the use of dynamically created formats for the subject identifiers illustrated on the vertical axis. The implementation is done through the use of PROC SQL and SAS macro. It is assumed that the reader has fundamental knowledge of the annotate feature, like the different co-ordinate systems and the know how to draw simple lines using the annotate feature. Two major parts are involved. The first part involves two steps. In the first step, a text/string of the required code is created. This can be implemented using the concatenation operator. E.g. To create a statement X= First Label fmtl=strip(start) strip("=") compress("'") strip(label) "'" In the second step the text string (code) is converted to a macro variable using PROC SQL. Macro variables can be created using PROC SQL in two different ways depending on the requirement. If the requirement is to create a macro variable for each record of the variable of interest the following code structure will be used: proc sql noprint select varint /* Variable of interest */ into :var1 -:var100 /* Macro variables to be created */ from srcds /* Source dataset */ If the requirement is to make all the records of the variable of interest into one macro variable, the following code structure will be used: proc sql select varint /* Variable of interest */ into :mvar separated by ' ' /* Macro variable to be created */ For the applications from srcds under discussion only the latter form /* of Source macro conversion dataset will */ be used. The second part involves invoking the macro variable. This is implemented using the ampersand operator where required in the program. E.g. : proc format &mvar Further applications of use of dynamically generating SAS statements has been discussed by the author previously 1. 2

Implementation a1 /* create dummy data */ data final input usubjid $ pt $ s_dur e_dur trt $ teaefl $ datalines A101 backpain 12 20 A N A102 backpain 14 25 A N A103 backpain 10 45 A N A104 backpain 23. A N A105 backpain 37 78 B Y A106 backpain 24 34 B Y A107 backpain 50. B N A107 backpain 56. B N a2 /* Formation of template */ data templ retain k t l u set final end=eof if missing(e_dur) then e_dur=0 if _n_ eq 1 then do t=e_dur u=s_dur k=max(e_dur,t) l=min(s_dur,u) t=k u=l if eof then do maxh=k+20k_str=put(maxh,best.) lnth=length(k_str) t1=input(substr(k_str,lnth,1),best.) t2=10-t1maxh=maxh+t2 call symput('ntot',put(_n_+5,best12.)) call symput('maxhx',put(maxh,best.)) y=_n_+5 x=maxh keep x y a3 /* actual plotting of data using annotate */ data anno1 length function $8 text $100 style $20 set final if teaefl eq 'N' then line=1 else if teaefl eq "Y" then line=20 a4 if _n_ eq 1 then i=1 else if _n_ ne 1 then i+1 retain line 1 xsys ysys '2' line 1 color 'black' when 'a' if not missing(e_dur) then do function="symbol" if trt eq "A" then do style="marker" text="c"size=0.75 else do style="marker" text="v"size=1 x=s_dur y=i function='move' x=s_dury=i function='draw'x=e_dury=i 3

function="symbol" if trt eq "A" then do style="marker" text="c"size=0.75 else do style="marker" text="v"size=1 x=e_dur y=i if missing(e_dur) then do function="symbol" if trt eq "A" then do style="marker" text="c"size=0.75 else do style="marker" text="v"size=1 x=s_dur y=i /* macro variables for proc format */ proc sort data=final by usubjid /* macro variable for proc format value */ data temp1 length labl $100 set final end=eof keep usubjid labl labl=put(_n_,best12.) '=' ' " ' usubjid ' " ' labl=compress(labl,' ') if eof then do labl="other=[otherid.]" usubjid="zyx" a5 /* macro variable for proc format picture */ data temp2 a6 length lablo $35 set temp1 end=eof by usubjid if first.usubjid and not last.usubjid and not eof then do lablo=strip(put(_n_,best12.)) '=' ' " ' ' ' ' " ' labl=" " if not first.usubjid and not last.usubjid and not eof then do lablo=strip(put(_n_,best12.)) '=' ' " ' ' ' ' " ' labl=" " else if first.usubjid and not last.usubjid and eof then lablo=strip(put(_n_,best12.)) '=' ' " ' ' ' ' " ' if usubjid eq "zyx" then do lablo=strip(put(_n_,best12.)) '=' ' " "' 4

/*insert dummy for proc format */ a7 if _n_ eq 1 then do lablo='0=' ' " "'usubjid= " "labl=" " lablo=strip(put(&ntot-3,best12.)) '=' ' " "'usubjid= " "labl=" " lablo=strip(put(&ntot-2,best12.)) '=' ' " "'usubjid= " "labl=" " lablo=strip(put(&ntot-1,best12.)) '=' ' " "'usubjid= " "labl=" " lablo=strip(put(&ntot,best12.)) '=' ' " "'usubjid= " "labl=" " /* macro variable for variable format value */ proc sql select labl into :labl_m separated by ' ' from temp2 /* macro variable for variableformat picture*/ proc sql select lablo into :lablo_m separated by ' ' from temp2 a8 proc format value ylabel (default=20) &labl_m picture otherid (default=20) &lablo_m data anno2 a9 length function $8 text $100 style $20 retain line 1 xsys ysys '2' line 1 color 'black' when 'a' style ' ' text ' ' function='label' text="treatment" x=31y=&ntot-1color='black'size=1 function="symbol"style="marker"text="c"size=0.75 color="black" x=27 y=&ntot-1.5 function='label'text="drug A" style=" "x=32y=&ntot-1.5 color='black'size=1.5 function="symbol"style="marker" text="v"size=1 color="black" x=27 y=&ntot-2 function='label' text="drug B" style=" " x=32 y=&ntot-2color='black'size=1.5 /* draw frame around legend */ function='move' x=25 y=&ntot-2.5 style=' ' text=' ' function='draw' x=40 y=&ntot-2.5 line=1style=' ' text=' ' function='draw' x=40 y=&ntot-0.5 line=1style=' ' text=' ' function='draw' x=25 y=&ntot-0.5 line=1style=' ' text=' ' function='draw' x=25 y=&ntot-2.5 line=1style=' ' text=' ' a10 5

data annof set anno1 anno2 a11 /* Figure setup */ title footnote options nodate nonumber orientation=landscape GOPTIONS reset=all device=png target=png xmax=7.5in ymax=4.5in xpixels=1500 ypixels=900 FTEXT="Courier" FTITLE="Courier/bold" FBy="Courier" ods rtf file="c:\documents and Settings\sramalingam\Desktop\test.rtf" style=tstylertf nogtitle nogfootnote /* combine annote and plot */ proc gplot data=templ a12 axis1 label=(angle=90 h=1.5 "Subject Id") order=(0 to &ntot by 1) value=( h=1.5) minor=none major=none width=1 axis2 split="," label=(h=1.5 'Days on Study Drug') order=(0 to &maxhx by 10) value=( h=1.5) offset=(1,1) plot y*x/anno=annof haxis=axis2 vaxis=axis1 format y ylabel. ods rtf close A simple dataset (FINAL) has been created to illustrate the technique [a1]. The variables of interest are the subject identifiers (USUBJID), preferred term (PT), start duration (S_DUR), end duration (E_DUR), treatment (TRT) and the treatment emergent adverse event flag (TEAEFL). A template (TEMPL) that defines the structure of the graph (X co-ordinate and Y co-ordinate) is created [a2]. The X co-ordinate is assigned the maximum value of the end duration (E_DUR) plus a constant (20). A macro variable, MAXHX, of the same value is created. The constant (20) is added to allow for sufficient space on the X-axis. The Y co-ordinate is assigned to the total number of observations (macro variable, NTOT) plus a constant (e.g. 5 to allow for sufficient space to insert the legend). An annotate dataset (ANNO1) is created to draw the symbols along with duration. Different symbols are then used to define each of the two treatments, A and B [a3]. The _N_ variable is used as the identifier for each of the subject records and serves as the Y axis value. Since only the data area is used, the co-ordinate system used is XSYS=2 and YSYS=2 2. A dashed line is used to represent adverse events that were treatment emergent [a4]. Different line styles to be used are available in the SAS online documentation 3. Now that the data values have all been defined, the next step is to create formats for the subject identifiers as _N_ was previously used as the identifier. Two formats are used. One is the regular, value format that associates each of the identifier values with that of the subject identifiers [a5]. The formats are dynamically generated using the core technique described previously. A dummy additional record is created so that the last value format statement assigns values not defined previously to the other format being used. The other format used is the picture format [a6]. This format ensures that for subjects having multiple entries of the same preferred term (e.g. subject A107), only the latest subject record is displayed on the graph and A107 is not displayed on the vertical axis twice. This format also ensures that the dummy records (as in the 5 additional records that were created to insert the legend) will be assigned a blank [a7]. The macro variables [a8] are created and the logic follows the same core technique discussed previously. Another annotate dataset (ANNO2) is created to create the legend [a9] and draw the frame around the legend [a10]. The two annotate datasets are then set together to create the final annotate dataset, ANNOF [a11]. The figure is then plotted using the standard GPLOT procedure [a12]. 6

Conclusion A technique to plot a graph for adverse event incidence and duration has been shown. Since only so many adverse events can be listed on a single page, the source dataset can be subset to display the graph on multiple pages if the need arises. References 1. Ramalingam, Sanjiv. Automating the Pooling of Variables Across Multiple Datasets Using Proc SQL and SAS Macro. PharmaSUG 2009, Portland, OR. 2. Carpenter, Art. 1999. Annotate: Simply the Basics. Cary, NC: SAS Institute Inc. 3. SAS online documentation for version 9. SAS Institute Inc. Cary, NC. [Cited Available from: http://support.sas.com/rnd/base/topics/statgraph/v91statgraphstyles.htm] Acknowledgements I would like to thank Allan Glaser, my manager for always reviewing my papers and offering constructive feedback. My acknowledgement would be incomplete without thanking Art Carpenter for his wonderful book on annotate that helped me get started and use this very powerful feature. 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 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. 7