PharmaSUG China Paper 70

Similar documents
One-Step Change from Baseline Calculations

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

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

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

Understanding and Applying the Logic of the DOW-Loop

Deriving Rows in CDISC ADaM BDS Datasets

Using GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China

Not Just Merge - Complex Derivation Made Easy by Hash Object

PharmaSUG Paper PO10

An Efficient Solution to Efficacy ADaM Design and Implementation

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

PharmaSUG Paper DS24

How to write ADaM specifications like a ninja.

PharmaSUG Paper CC11

Creating an ADaM Data Set for Correlation Analyses

PharmaSUG DS05

Amie Bissonett, inventiv Health Clinical, Minneapolis, MN

Reproducibly Random Values William Garner, Gilead Sciences, Inc., Foster City, CA Ting Bai, Gilead Sciences, Inc., Foster City, CA

A Taste of SDTM in Real Time

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

PharmaSUG Paper DS06 Designing and Tuning ADaM Datasets. Songhui ZHU, K&L Consulting Services, Fort Washington, PA

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

Please Don't Lag Behind LAG!

PharmaSUG Paper PO22

Macro Quoting: Which Function Should We Use? Pengfei Guo, MSD R&D (China) Co., Ltd., Shanghai, China

PharmaSUG China

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

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

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

Basic SAS Hash Programming Techniques Applied in Our Daily Work in Clinical Trials Data Analysis

ODS/RTF Pagination Revisit

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

SAS automation techniques specification driven programming for Lab CTC grade derivation and more

PharmaSUG China Paper 059

An Alternate Way to Create the Standard SDTM Domains

SAS (Statistical Analysis Software/System)

Applying ADaM Principles in Developing a Response Analysis Dataset

CMISS the SAS Function You May Have Been MISSING Mira Shapiro, Analytic Designers LLC, Bethesda, MD

PhUSE US Connect 2019

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

Working with Composite Endpoints: Constructing Analysis Data Pushpa Saranadasa, Merck & Co., Inc., Upper Gwynedd, PA

Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ

PharmaSUG2014 Paper DS09

PharmaSUG Paper PO03

The Benefits of Traceability Beyond Just From SDTM to ADaM in CDISC Standards Maggie Ci Jiang, Teva Pharmaceuticals, Great Valley, PA

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

PharmaSUG 2014 PO16. Category CDASH SDTM ADaM. Submission in standardized tabular form. Structure Flexible Rigid Flexible * No Yes Yes

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

SAS Application to Automate a Comprehensive Review of DEFINE and All of its Components

Advanced Visualization using TIBCO Spotfire and SAS

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

The Power of Combining Data with the PROC SQL

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

It s All About Getting the Source and Codelist Implementation Right for ADaM Define.xml v2.0

PharmaSUG Paper AD03

Harmonizing CDISC Data Standards across Companies: A Practical Overview with Examples

Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA

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

Hands-On ADaM ADAE Development Sandra Minjoe, Accenture Life Sciences, Wayne, Pennsylvania

Programming checks: Reviewing the overall quality of the deliverables without parallel programming

How to validate clinical data more efficiently with SAS Clinical Standards Toolkit

Lab CTCAE the Perl Way Marina Dolgin, Teva Pharmaceutical Industries Ltd., Netanya, Israel

Customizing SAS Data Integration Studio to Generate CDISC Compliant SDTM 3.1 Domains

Introduction to ADaM standards

Quality Control of Clinical Data Listings with Proc Compare

PharmaSUG Paper TT11

Best Practices for E2E DB build process and Efficiency on CDASH to SDTM data Tao Yang, FMD K&L, Nanjing, China

Traceability Look for the source of your analysis results

%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System

Journey to the center of the earth Deep understanding of SAS language processing mechanism Di Chen, SAS Beijing R&D, Beijing, China

When Powerful SAS Meets PowerShell TM

IF there is a Better Way than IF-THEN

SAS Clinical Data Integration 2.4

Traceability in the ADaM Standard Ed Lombardi, SynteractHCR, Inc., Carlsbad, CA

Automation of SDTM Programming in Oncology Disease Response Domain Yiwen Wang, Yu Cheng, Ju Chen Eli Lilly and Company, China

Anatomy of a Merge Gone Wrong James Lew, Compu-Stat Consulting, Scarborough, ON, Canada Joshua Horstman, Nested Loop Consulting, Indianapolis, IN, USA

Clinical Data Visualization using TIBCO Spotfire and SAS

START CONVERTING FROM TEXT DATE/TIME VALUES

An Introduction to Visit Window Challenges and Solutions

Table of Contents. The RETAIN Statement. The LAG and DIF Functions. FIRST. and LAST. Temporary Variables. List of Programs.

PharmaSUG China Big Insights in Small Data with RStudio Shiny Mina Chen, Roche Product Development in Asia Pacific, Shanghai, China

PharmaSUG Paper AD06

Super boost data transpose puzzle

SAS Macros of Performing Look-Ahead and Look-Back Reads

An Efficient Tool for Clinical Data Check

The Dataset Diet How to transform short and fat into long and thin

Doctor's Prescription to Re-engineer Process of Pinnacle 21 Community Version Friendly ADaM Development

Implementing CDISC Using SAS. Full book available for purchase here.

What is the ADAM OTHER Class of Datasets, and When Should it be Used? John Troxell, Data Standards Consulting

Cleaning up your SAS log: Note Messages

Hands-On ADaM ADAE Development Sandra Minjoe, Accenture Life Sciences, Wayne, Pennsylvania Kim Minkalis, Accenture Life Sciences, Wayne, Pennsylvania

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

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

SAS Clinical Data Integration 2.6

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

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

The Path To Treatment Pathways Tracee Vinson-Sorrentino, IMS Health, Plymouth Meeting, PA

Chapter 6: Modifying and Combining Data Sets

Quick and Efficient Way to Check the Transferred Data Divyaja Padamati, Eliassen Group Inc., North Carolina.

A Macro to Create Program Inventory for Analysis Data Reviewer s Guide Xianhua (Allen) Zeng, PAREXEL International, Shanghai, China

Transcription:

ABSTRACT PharmaSUG China 2015 - Paper 70 SAS Longitudinal Data Techniques - From Change from Baseline to Change from Previous Visits Chao Wang, Fountain Medical Development, Inc., Nanjing, China Longitudinal data is often collected in clinical trials to examine the effect of treatment on the disease process over time. The most common operation against this type data is to calculate the change from baseline (CFB). The proven ways to implement this calculation in SAS may include data splitting, one pass DOW (Dorfman-Whitlock DO) - Loop, retain plus LAG function. Sometimes, in addition to CFB, change from previous visits (CFP) could be interesting endpoints for a trial. This paper demonstrates how CFP can be derived with minimum coding by using SAS LAG (N) Function. INTRODUCTION In clinical trials, most of the endpoints are collected with multiple visits. It would be very helpful to examine the effect of treatment on the disease process over the time. And based on pharmaceutical industry practice, the collected data will be remapped to the SDTM and AdaM sequentially. This type data contains one or more records per subject, per analysis parameter, per analysis timepoint. We call it Basic Data Structure (BDS) in CDISC, and Longitudinal data in general. Figure 1 shows a general sample data. Figure 1 Sample Data Change From Baseline (hereinafter referred to as "CFB") is a very common operation against this type data. There are many ways and techniques have been discussed in previous papers. In summary, there are 3 ways, Data Splitting: (Baseline part plus post-baseline parts) Retain Method One pass DOW (Dorfman-Whitlock DO) Loop But sometimes, calculate the Change FROM PREVIOUS VISITS (hereinafter referred to as "CFP") are also required. It s an interesting endpoint for some trials. Could the three CFB ways be expand used to calculate the CFP? This topic will be discussed in following part. THREE METHODS OF CFB The sample data will be used to show the ways to calculate the CFB. The variable names of the 5 columns are SUBJID, ADY, PARAMCD, AVAL and ABLFL and the dataset have been sorted by SUBJID, PARAMCD, ADY. DATA SPLITTING This method splits baseline data from the whole dataset. Then merge back by the key variables. It s a very simple way to get the baseline results. The example code is listed below, data base post; if ABLFL = "Y"; 1

data _cfb1; merge sample(in=a) baseline(keep=subjid paramcd aval rename = (aval=base)); by subjid paramcd; CHG = AVAL - BASE; RETAIN METHOD Retain Statement is popular used in CFB calculation. It can carry the value of the specified variable to next iterations. The example code is listed below, data _cfb2; retain tmp 0 tmpdy 0; if ABLFL = "Y" then do; base = aval; tmp = base; tmpdy= ady; if ady >= tmpdy then do; base = tmp; chg = aval - tmp; drop tmp tmpdy; ONE PASS DOW LOOP The DOW-Loop is a technique originally developed by Don Henderson, and popularized on the SAS-L listserv by Paul Dorfman and Ian Whitlock. The rational of this technique is taking control of the implicit DO-Loop inherent in the DATA step, identifying and storing the baseline value in a variable that is retained until all post-baseline values for a subject have been processed, and then writing out only those post-baseline values. The example code is listed below, data _cfb3; do until (last.paramcd); if ABLFL = "Y" then base = aval; else do; chg = aval - base; output; Compared the 3 outputs in Figure 2, we found the limitations of the 3 methods. The methods 1 and 3 are easy to calculate CFB for the post-baseline records. When we try to finish the calculation in one step, the RETAIN statement have more flexibly strength. 2

THE METHODS TO CALCULATE CFP Figure 2 The outputs of 3 CFB methods When facing the CFP, many weapons present to our eyes - Array, Do Loop, Retain, LAG, DIF and etc. And the three CFB methods may expand to solve this question. Talk more details, a subject may have 5 visits (V1, V2, V3, V4 and V5). So we need to calculate the V21 (namely V2 change from V1), V31, V41, V51; V32, V42, V52; V43, V53; and V54. More generally, a subject may have N visits, so we need to calculate Vji (j = 2 N, I = 1 j), the total number of Vji is N*(N-1)/2. Wow, the problem become a little more complicated, especially the number of VISITs are not identical for different subjects. It will be very hard to apply the Data Splitting. The One Pass DOW Loop method is similar as RETATIN method, both of them use the iteration of Data Step. But the RETAIN method is more clarity. A general way is using the ARRAY to transpose the visit information into horizontal, then use the DO-Loop to calculate the result by each interval. Is there any longitudinal ways? The answer is YES. In high school, we may use a trick to solve some hardly equation questions. Like, X Y = (X Z) + (Y-Z). So, V42 = V4 V2 = V4 V3 + V3 V2 V52 = V5 V2 = V5 V4 + V4 V3 + V3 V2 Then LAG/DIF function comes to our mind. We can summarize the DIF to get the result. Generally, the Vji = j 1 DIF(k + 1) k=i,i<j Bravo, we got the formula. Let use the two-levels do loop to solve this issue. One level is DO j from 2 to N, another level is DO from i from 1 to j-1. The speaking is easy, but it s very hard to make it come true. The problem spot is the sum (the SIGMA part). SAS only provides the horizontal summation function. This statement may be challenged by others. Because SAS also provides the SUM, a vertical summation tool, like RETAIN, a component to handle the longitudinal data. But the SUM tool is relied on RETAIN. It will make the programming work more complexity. When searching the LAG/DIF function, we found these two functions have some special attributes. In SAS official document, the statement of LAG function is below, LAG <n> (argument) Unlike many other functions, it not only have argument, but also have a dimension. The n specifies the number of lagged values. DIF has the same powerful function. 3

Based on this feature, we can update the formula to this, V42 = V4 V2 = V4 V3 + V3 V2 = V43 + V32 V52 = V5 V2 = V5 V3 + V3 V2 = V53 + V32 So the general formula will be Vji = Vj,i+1+Vi+1,i. In SAS, it will be DIFj-i = DIFJ-(I+1) + LAGi The mind behind this formula is: calculating the interval = 1 (V21, V32, V43 and Vi+1,i) firstly, then calculating the interval = 2 (V31, V42, V53 and Vi+2, i) and so on. Use the sample data to do a test, after running the code, we got the result as Figure 3, Figure 3 The Example of CFP data sample1; retain n 1; dif0 = dif(aval); if first.subjid then dif0 =.; if first.subjid then n = 1; else n+1; %macro diff; data dif; set sample1; array dif[6] dif1-dif6; dif[1] = dif0; %do i = 2 %to 6; %let j = %eval(&i.-1); dif[&i] = dif[&i-1] + lag&j.(dif0); if N < &i then dif[&i] =.; % drop dif0; %mend diff; %diff; 4

In above codes, we can update the dimension of ARRAY by using the macro variables, it will make the program more flexible. And we can also put the DIF1-DIF6 into one variable and made the dataset vertically. It will be more useful for the analysis. CONCLUSION LAGn, DIFn and Retain are The Three Musketeers to handle the longitudinal data. The built-in iteration function of LAGn and DIFn provides more flexibility to retrieve and manipulate the records vertically. With the help of ARRAY, the user could write more simplicity codes to conquer the difficulty tasks. REFERENCES Nancy Brucken, 2009. One-Step Change from Baseline Calculations, SAS Global Forum 2009. http://support.sas.com/resources/papers/proceedings09/081-2009.pdf Chakravarthy, Venky. 2005. RETAIN or NOT? Is LAG Far Behind?. PharmaSUG 2005 Conference Proceedings. http://www.lexjansen.com/pharmasug/2005/coderscorner/cc19.pdf H. Ament. 2011. Learning to love the SAS LAG function. PhUSE 2011. http://www.phusewiki.org/docs/2011%20papers/cc08%20paperl.pdf ACKNOWLEDGMENTS The author would like to thank Shanshan Wang and Xin Ke, who generously provided helpful comments and encouragements. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Name: Chao Wang Enterprise: Fountain Medical Development, Inc. Address: Room 402, Building 43, No.70, Headquarter Base, Phoenix Road, Jiangning District City, State ZIP: Nanjing, China Work Phone: 025-86155007 E-mail: chao.wang@fountain-med.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. 5