/********************************************/ /* Evaluating the PS distribution!!! */ /********************************************/

Similar documents
PSS weighted analysis macro- user guide

Using SAS to Analyze CYP-C Data: Introduction to Procedures. Overview

Interactive Programming Using Task in SAS Studio

SD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG

Getting Classy: A SAS Macro for CLASS Statement Automation

Day 4 Percentiles and Box and Whisker.notebook. April 20, 2018

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

Want to Do a Better Job? - Select Appropriate Statistical Analysis in Healthcare Research

A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes

Analysis of Complex Survey Data with SAS

UTILIZING DATA FROM VARIOUS DATA PARTNERS IN A DISTRIBUTED MANNER

Overview of the CohortMethod package. Martijn Schuemie

Teaching statistics and the SAS System

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

SAS is the most widely installed analytical tool on mainframes. I don t know the situation for midrange and PCs. My Focus for SAS Tools Here

SAS Instructions Entering the data and plotting survival curves

To conceptualize the process, the table below shows the highly correlated covariates in descending order of their R statistic.

A Side of Hash for You To Dig Into

PharmaSUG Paper SP07

SAS Enterprise Miner : Tutorials and Examples

Paper SDA-11. Logistic regression will be used for estimation of net error for the 2010 Census as outlined in Griffin (2005).

Two useful macros to nudge SAS to serve you

Creating Macro Calls using Proc Freq

Ranking Between the Lines

Data Quality Review for Missing Values and Outliers

Types of Data Mining

A Macro for Systematic Treatment of Special Values in Weight of Evidence Variable Transformation Chaoxian Cai, Automated Financial Systems, Exton, PA

Facilitate Statistical Analysis with Automatic Collapsing of Small Size Strata

Frequencies, Unequal Variance Weights, and Sampling Weights: Similarities and Differences in SAS

A General SAS Macro to Implement Optimal N:1 Propensity Score Matching Within a Maximum Radius

SAS Example A10. Output Delivery System (ODS) Sample Data Set sales.txt. Examples of currently available ODS destinations: Mervyn Marasinghe

MR-2010I %PHChoice Macro %PHChoice Macro

Reducing Credit Union Member Attrition with Predictive Analytics

Combining the Results from Multiple SAS PROCS into a Publication Quality Table

WEB MATERIAL. eappendix 1: SAS code for simulation

Statements with the Same Function in Multiple Procedures

Outline. Topic 16 - Other Remedies. Ridge Regression. Ridge Regression. Ridge Regression. Robust Regression. Regression Trees. Piecewise Linear Model

Package CausalGAM. October 19, 2017

Metadata and ADaM.

An Optimal Search Process of Eigen Knots. for Spline Logistic Regression. Research Department, Point Right

SAS Programs SAS Lecture 4 Procedures. Aidan McDermott, April 18, Outline. Internal SAS formats. SAS Formats

PROC MEANS for Disaggregating Statistics in SAS : One Input Data Set and One Output Data Set with Everything You Need

Smoking and Missingness: Computer Syntax 1

Extensions to the Cox Model: Stratification

Continuous Predictors in Regression Analyses

3.3 The Five-Number Summary Boxplots

A SAS MACRO for estimating bootstrapped confidence intervals in dyadic regression

ABSTRACT INTRODUCTION MACRO. Paper RF

A SAS Macro for Covariate Specification in Linear, Logistic, or Survival Regression

Package epitab. July 4, 2018

PharmaSUG Paper TT11

Enterprise Miner Software: Changes and Enhancements, Release 4.1

THIS IS NOT REPRESNTATIVE OF CURRENT CLASS MATERIAL. STOR 455 Midterm 1 September 28, 2010

LIBNAME CCC "H:\Papers\TradeCycle _replication"; /*This is the folder where I put all the three data sets.*/ RUN;

ECLT 5810 Data Preprocessing. Prof. Wai Lam

Data-Analysis Exercise Fitting and Extending the Discrete-Time Survival Analysis Model (ALDA, Chapters 11 & 12, pp )

Basic Concepts #6: Introduction to Report Writing

SAS Enterprise Miner: Code Node Tips

Creating Complex Graphics for Survival Analyses with the SAS System

Enterprise Miner Tutorial Notes 2 1

A SAS and Java Application for Reporting Clinical Trial Data. Kevin Kane MSc Infoworks (Data Handling) Limited

Centering and Interactions: The Training Data

Paper Appendix 4 contains an example of a summary table printed from the dataset, sumary.

Data Quality Control for Big Data: Preventing Information Loss With High Performance Binning

Exposure-Response Plots Using SAS Janette Garner, Gilead Sciences, Inc., Foster City, CA

Data Quality Control: Using High Performance Binning to Prevent Information Loss

The SAS %BLINPLUS Macro

Module I: Clinical Trials a Practical Guide to Design, Analysis, and Reporting 1. Fundamentals of Trial Design

Package sparsereg. R topics documented: March 10, Type Package

An Efficient Tool for Clinical Data Check

An introduction to SPSS

Data Analysis and Solver Plugins for KSpread USER S MANUAL. Tomasz Maliszewski

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

The SAS LGTPHCURV9 Macro

A Comparison of Modeling Scales in Flexible Parametric Models. Noori Akhtar-Danesh, PhD McMaster University

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

STAT:5400 Computing in Statistics

Survival Analysis with PHREG: Using MI and MIANALYZE to Accommodate Missing Data

Multi-label classification using rule-based classifier systems

Automated Macros to Extract Data from the National (Nationwide) Inpatient Sample (NIS)

Chapter 6: Modifying and Combining Data Sets

Chapter 1 Changes and Enhancements to SAS/STAT Software in Versions 7 and 8

Applied Regression Modeling: A Business Approach

BACKGROUND INFORMATION ON COMPLEX SAMPLE SURVEYS

Acknowledgments. Acronyms

Introduction to SAS. I. Understanding the basics In this section, we introduce a few basic but very helpful commands.

SAS (Statistical Analysis Software/System)

STAT 503 Fall Introduction to SAS

Using PROC RANK and PROC UNIVARIATE to Rank or Decile Variables

EXST3201 Mousefeed01 Page 1

Paper CC-016. METHODOLOGY Suppose the data structure with m missing values for the row indices i=n-m+1,,n can be re-expressed by

Level I: Getting comfortable with my data in SAS. Descriptive Statistics

SAS CLINICAL SYLLABUS. DURATION: - 60 Hours

BY S NOTSORTED OPTION Karuna Samudral, Octagon Research Solutions, Inc., Wayne, PA Gregory M. Giddings, Centocor R&D Inc.

Missing Data: What Are You Missing?

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

Simulation of Imputation Effects Under Different Assumptions. Danny Rithy

One-PROC-Away: The Essence of an Analysis Database Russell W. Helms, Ph.D. Rho, Inc.

Correctly Compute Complex Samples Statistics

SAS 9 Programming Enhancements Marje Fecht, Prowerk Consulting Ltd Mississauga, Ontario, Canada

Transcription:

SUPPLEMENTAL MATERIAL: Example SAS code /* This code demonstrates estimating a propensity score, calculating weights, */ /* evaluating the distribution of the propensity score by treatment group, and */ /* evaluating treatment effect heterogeneity over the distribution of the!! */ /* propensity score.!!!!!!!!!!!!!!! */ /* This program written in SAS 9.2 TM, February 2013!!!!!!! */ /* Prepared by Bradley Layton, PhD at the University of North Carolina at!! */ /* Chapel Hill!!!!!!!!!!!!!!!!! */ /* Variable Definitions:!!!!!!!!!!!!!! */ /* x = binary [0,1] treatment variable!!!!!!!!!!! */ /* y = binary [0,1] outcome variable!!!!!!!!!!! */ /* c1 - c5 = binary [0,1] covariates!!!!!!!!!!! */ /* y_dur = time until censoring for event y!!!!!!!!!! */ /* Estimating a propensity score!!! */ /* Modeling treatment = 1 given covariates and outputting data with the propensity score into a new dataset, 'PS_DATA' PS = estimated propensity score!!! */ PROC LOGISTIC DATA=raw_data DESCENDING;! MODEL x = c1 c2 c3 c4 c5;! OUTPUT OUT=ps_data PROB=ps;! TITLE "Estimation of the propensity score from measured covariates"; /* Evaluating the PS distribution!!! */ /* Creating PS treatment groups for plotting */ DATA ps_data;! SET ps_data;! IF x = 1 THEN treated_ps = ps;!! ELSE treated_ps =.;! IF x = 0 THEN untreated_ps = ps;!! ELSE untreated_ps =.;

/* Plot the overlap of the PS distributions by treatment group Turn on ODS output to get high quality graphics saved as an image file PLOTS=ALL gives you multiple plots. If you only want the overlay plot, use PLOTS=DENSITYOVERLAY */ ODS GRAPHICS ON; PROC KDE DATA=ps_data;! UNIVAR untreated_ps treated_ps / PLOTS=densityoverlay;! TITLE "Propensity score distributions by treatment group"; ODS GRAPHICS OFF; /* Calculating PS weights!!!!! */! /* Calculating the marginal probability of treatment for the stabilized IPTW */ PROC MEANS DATA=ps_data(keep=ps) NOPRINT;! OUTPUT OUT=ps_mean MEAN=marg_prob;! SET ps_mean;! CALL SYMPUT("marg_prob",marg_prob); /* Calculating weights from the propensity score */ DATA ps_data;! SET ps_data;! *Calculating IPTW;! IF x = 1 THEN iptw = 1/ps;!! ELSE IF x = 0 then iptw = 1/(1-ps);! *Calculating stabilized IPTW;! IF x = 1 THEN siptw = &marg_prob/ps;!! ELSE IF x = 0 THEN siptw = (1-&marg_prob)/(1-ps);! *Calculating SMRW;! IF x = 1 THEN smrw = 1;!! ELSE IF x = 0 THEN smrw = ps/(1-ps);! LABEL! ps = "Propensity Score"

!!! iptw = "Inverse Probability of Treatment Weight"!!! sisptw = "Stabilized Inverse Probability of Treatment Weight"!!! smrw = "Standardized Mortality Ratio Weight"; /* Evaluating the weights and preparing for */ /* trimming if necessary!!!!! */ /* Performing univariate analysis on the weight variables by treatment status to check for extreme weights */ PROC UNIVARIATE DATA=ps_data;! CLASS x;! VAR iptw siptw smrw;! TITLE "Evaluating weights by treatment group"; /* Identifying percentiles at the upper and lower extremes of the untreated and treated! PS distributions for trimming, if needed. If other percentiles are needed, they can! be created in the OUTPUT statement either by using a predefined SAS percentile,! or by creating one in PCTLPTS=" */ PROC UNIVARIATE DATA=ps_data NOPRINT;! CLASS x;! OUTPUT OUT=ps_pctl MIN=min MAX=max P1=p1 P99=p99 PCTLPTS=0.5 99.5 PCTLPRE=p;! title "Distribution of Propensity Score for Statin use, by statin use"; /* Labeling the percentiles at the lower extremes of the treated in macro variables which can be! called later.! Defining the minimum, 0.5th percentiles, and 1st percentile of the treated */! SET ps_pctl;! WHERE x = 1;! CALL SYMPUT("treated_min",min);! CALL SYMPUT("treated_05",p0_5);! CALL SYMPUT("treated_1",p1); /* Labeling the percentiles at the upper extremes of the untreated in macro variables which can be called later. Defining the maximum, 99th, and 99.5th percentile of the untreated. */! SET ps_pctl;! WHERE x = 0;! CALL SYMPUT("untreated_max",max);! CALL SYMPUT("untreated_99",p99);! CALL SYMPUT("untreated_995",p99_5);

/* When applying PS weights to analyses, these defined percentiles can be applied to trim areas of non-overlap and individuals treated contrary to prediction. To trim non-overlapping regions of the PS distribution, include the following statement in the modeling procedure: WHERE &treated_min <= ps <= &untreated_max; To trim those treated contrary to prediction, include the following statement: WHERE &treated_05 <= ps <= &untreated_995 Trimming percentiles can be moved in progressively as far as desired */ /* Checking for treatment effect!!! */ /* heterogeneity!!!!!!! */ /* Stratify the PS distribution into deciles If a different number of strata are desired, change to the desired number, N, in! the GROUPS statement If changing the number of strata, also change the number in the '%DO i=0 %TO N' statement below to N-1 */ /* Create a new dataset with the strata indicator variables, 'ps_strata' Create a new variable for the strata rank, 'ps_decile' */ PROC RANK DATA=ps_data! GROUPS = 10! OUT = ps_data;! RANKS ps_decile; /* Evaluate the outcomes, PS, and weights by treatment in each strata Check for heterogeneity of treatment effect across the strata Create a macro to perform the descriptive statistics and estimate effect measure in each decile */ %MACRO deciles; %DO i= 0 %TO 9; PROC FREQ DATA=ps_data;! TABLE y*x;! TITLE "Outcome Y by Exposure X in PS deciles in decile &i"; run; PROC MEANS DATA=ps_data MIN MEDIAN MAX MEAN;! CLASS X;! VAR ps iptw siptw smrw;! TITLE "Distribution of PS and weights by treatment in decile &i"; /* y_dur is the time until censoring for event y */ PROC PHREG DATA=ps_data;

! CLASS x / desc;! MODEL y_dur*y(0) = x;! HAZARDRATIO x;! TITLE "Hazard ratio of Exposure X on Outcome Y in decile &i"; %END; %MEND deciles; /* Call the macro to estimate frequencies, PS distributions, and effect measures in each strata %deciles; /* The weights can be applied to various modelling PROCs in SAS, or PS matching! can be performed using any number of matching algorithms */