BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
asinusdk
Calcite | Level 5

I made a table for Cox hazard regression. Data was repeatedly measured, but the outcome can only once occur because it is death. Var 1-3 are all categorical. Var 1 is time-invariant while var 2 and var3 are time-varying predictors. I wonder if I've made a right format for the analysis and if my codes for proc phreg is correct.

proc phreg data=death;

class var1(ref='1') var2(ref='0') var(ref='0');

model riskp*event(0)=var1 var2 var3;

run;

 

data death;
input year   id   var1   var2   var3   event  riskp ddates;
cards;
1999 1 1 3 0 0 12 . 2000 1 1 3 0 0 12 . 2001 1 1 3 0 0 12 . 2002 1 1 3 1 0 12 . 2003 2 2 3 0 0 12 . 1999 2 2 1 0 0 12 . 2000 2 2 1 1 0 12 . 2001 2 2 2 1 0 12 . 2002 2 2 2 1 0 12 . 2000 2 2 2 0 0 12 . 2001 3 2 1 0 0 12 . 2002 3 2 1 1 0 12 . 2003 3 2 1 1 1 7 201307;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @asinusdk,

 

Sorry for the late reply.

 

Your variable RISKP doesn't look like a (survival) time variable, which is required in the MODEL statement.

 

You need

  1. either a dataset with one observation per subject and a survival time variable indicating after how many time units the death occurred or the subject was censored or
  2. a dataset with (one or) multiple observations per subject each of which describes a time interval. In this case two time variables indicate the start and end point of the interval (t1, t2]. This second option is referred to as Counting Process Style of Input in the documentation.

In the first case, time-dependent covariates can be defined using programming statements (similar to DATA step statements) in the PROC PHREG step. For your data, involving repeated measurements, the second option is more suitable because you can easily supply different values of the time-dependent variables for different time intervals. Please see Example 87.7 Time-Dependent Repeated Measurements of a Covariate in the documentation.

 

I assume the third variable name "var" in the CLASS statement should read "var3". Using reference value '0' for var2 requires that it occurs at least once in the input dataset (more precisely: in an observation that is actually used in the analysis), which is not the case in your sample data.

View solution in original post

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @asinusdk,

 

Sorry for the late reply.

 

Your variable RISKP doesn't look like a (survival) time variable, which is required in the MODEL statement.

 

You need

  1. either a dataset with one observation per subject and a survival time variable indicating after how many time units the death occurred or the subject was censored or
  2. a dataset with (one or) multiple observations per subject each of which describes a time interval. In this case two time variables indicate the start and end point of the interval (t1, t2]. This second option is referred to as Counting Process Style of Input in the documentation.

In the first case, time-dependent covariates can be defined using programming statements (similar to DATA step statements) in the PROC PHREG step. For your data, involving repeated measurements, the second option is more suitable because you can easily supply different values of the time-dependent variables for different time intervals. Please see Example 87.7 Time-Dependent Repeated Measurements of a Covariate in the documentation.

 

I assume the third variable name "var" in the CLASS statement should read "var3". Using reference value '0' for var2 requires that it occurs at least once in the input dataset (more precisely: in an observation that is actually used in the analysis), which is not the case in your sample data.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1247 views
  • 0 likes
  • 2 in conversation