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

Hi All,

 

I'm doing survival analysis, and I want to censor data >5 and state=2 or state=3, and the SAS code I'm writing is

 

proc phreg data=bc.def;

      class size (ref ='1') / param=ref;

      model survive(<=5)*state(2|3)=size/ties=exact rl;

run;

 

While

size which has 4 categories (1, 2, 3, 4)

state which has 3 categories (1, 2, 3), and 1=event

survive should be less than or equal 5

 

I wonder whether it's possible to modify the above code, and get what I intend to do. I appreciate your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Tawfiq
Fluorite | Level 6

Thanks for your help! It also works!

View solution in original post

6 REPLIES 6
Reeza
Super User

Is that working code? 

I'm a bit uncertain what your question is here. 

Tawfiq
Fluorite | Level 6

Hi Reeza,

 

The code is not working. What I want is to censor survive >5 for state 2 and state 3 and get survive <=5 for state=1. If I use the model as follows

proc phreg data=bc.def;

      class size (ref ='1') / param=ref;

      model survive*state(2)=size/ties=exact rl;

run;

 

the model works; but it doesn't provide survive <=5 and it adds state=3 with state=1 (or event=1) which shouldn't be the case. My purpose is to to use the model with the 2 conditions as ... model survive (<=5)*state(2 &3)=size/ties=exact rl;

 

Reeza
Super User

I think you need to precalculate the censor and survival time variables. Use a data step to create new variables that have the values you need. 

Tawfiq
Fluorite | Level 6

Hi Reeza,

 

I created two variables (one for censoring and another for survival_5y) and used the model and it worked!

 

Thanks for the help!

JacobSimonsen
Barite | Level 11

You first need to create a new censoring variable. And you can run your Cox-regression:

data mydata;
   set bc.def;
   if (survive>5)+(state in (2,3)) then censur=1;
  else censur=0;
run;

proc phreg data=mydata;
      class size (ref ='1') / param=ref;
      model survive*censur(1)=size/ties=exact rl;
run;

Good luck:-)

 

Tawfiq
Fluorite | Level 6

Thanks for your help! It also works!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 6 replies
  • 1541 views
  • 1 like
  • 3 in conversation