EPI 5344 Survival Analysis in Epidemiology SAS Code

  • Slides: 21
Download presentation
EPI 5344: Survival Analysis in Epidemiology SAS Code for Cox models March 18, 2014

EPI 5344: Survival Analysis in Epidemiology SAS Code for Cox models March 18, 2014 Dr. N. Birkett, Department of Epidemiology & Community Medicine, University of Ottawa 01/2014 1

SAS code (1) • Cox models use Proc PHREG – I assume that you

SAS code (1) • Cox models use Proc PHREG – I assume that you all have at least Version 9. 2 of SAS • Prior to this version, ‘phreg’ was more limited • An experimental version (tphreg) could be used instead. BUT, I strongly encourage you to upgrade to at least SAS 9. 2 01/2014 2

libname allison 'C: /allison_2010/data_sets'; PROC PHREG DATA=allison. recid; MODEL week*arrest(0)=fin age race wexp mar

libname allison 'C: /allison_2010/data_sets'; PROC PHREG DATA=allison. recid; MODEL week*arrest(0)=fin age race wexp mar paro prio; RUN; 01/2014 3

01/2014 4

01/2014 4

01/2014 5

01/2014 5

01/2014 6

01/2014 6

title 'Ties Handling: BRESLOW'; PROC PHREG DATA=allison. recid; MODEL week*arrest(0)=fin age race wexp mar

title 'Ties Handling: BRESLOW'; PROC PHREG DATA=allison. recid; MODEL week*arrest(0)=fin age race wexp mar paro prio / TIES=BRESLOW; RUN; title 'Ties Handling: EFRON'; PROC PHREG DATA=allison. recid; MODEL week*arrest(0)=fin age race wexp mar paro prio / TIES=EFRON; RUN; title 'Ties Handling: EXACT’; PROC PHREG DATA=allison. recid; MODEL week*arrest(0)=fin age race wexp mar paro prio / TIES=EXACT; RUN; 01/2014 7

Breslow Efron Exact 01/2014 8

Breslow Efron Exact 01/2014 8

Breslow Efron Exact 01/2014 9

Breslow Efron Exact 01/2014 9

Breslow Efron & Exact 01/2014 10

Breslow Efron & Exact 01/2014 10

PROC PHREG DATA=allison. recid; class fin /param=ref ref=last ; MODEL week*arrest(0)=fin age race wexp

PROC PHREG DATA=allison. recid; class fin /param=ref ref=last ; MODEL week*arrest(0)=fin age race wexp mar paro prio / TIES=EFRON; RUN; PROC PHREG DATA=allison. recid; class fin /param=effect ; MODEL week*arrest(0)=fin age race wexp mar paro prio / TIES=EFRON; RUN; 01/2014 11

Reference coding 01/2014 12

Reference coding 01/2014 12

An issue with ref coding (1) • By default, SAS orders the levels of

An issue with ref coding (1) • By default, SAS orders the levels of a categorical variable by the ‘format’ labels if they have been assigned. • Consider: 01/2014 Category Format Order 1 low 2 2 in-between 1 3 most 3 13

An issue with ref coding (2) • You want to use ‘level=1’ as the

An issue with ref coding (2) • You want to use ‘level=1’ as the reference. • This SAS code won’t do that: class x/param=ref ref=first; • Instead, the reference will be level 2. • You must use this code: class x/param=ref ref=first order=internal; 01/2014 14

Effect coding 01/2014 15

Effect coding 01/2014 15

Three-level class variable • Just for test purposes, define a 3 level variable –

Three-level class variable • Just for test purposes, define a 3 level variable – combines race and financial aid: 01/2014 Race Financial aid Racefin 0 0 1 1 1 0 2 1 1 3 16

PROC PHREG DATA=njb 1; class racefin /param=ref ref=last ; MODEL week*arrest(0)=racefin age / TIES=EFRON;

PROC PHREG DATA=njb 1; class racefin /param=ref ref=last ; MODEL week*arrest(0)=racefin age / TIES=EFRON; RUN; PROC PHREG DATA=njb 1; class racefin /param=effect ; MODEL week*arrest(0)=racefin age / TIES=EFRON; RUN; PROC PHREG DATA=njb 1; class racefin /param=orthopoly ; MODEL week*arrest(0)=racefin age / TIES=EFRON; RUN; 01/2014 17

Reference coding 01/2014 18

Reference coding 01/2014 18

Effect coding 01/2014 19

Effect coding 01/2014 19

Ortho-polynomial coding 01/2014 20

Ortho-polynomial coding 01/2014 20

01/2014 21

01/2014 21