Programming the statistical procedures from SAS

Survival Analysis with 3 levels of censor

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

Survival Analysis with 3 levels of censor

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!


Accepted Solutions
Solution
‎04-01-2017 05:43 PM
Occasional Contributor
Posts: 11

Re: Survival Analysis with 3 levels of censor

Thanks for your help! It also works!

View solution in original post


All Replies
Grand Advisor
Posts: 16,930

Re: Survival Analysis with 3 levels of censor

Is that working code? 

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

Occasional Contributor
Posts: 11

Re: Survival Analysis with 3 levels of censor

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;

 

Grand Advisor
Posts: 16,930

Re: Survival Analysis with 3 levels of censor

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. 

Occasional Contributor
Posts: 11

Re: Survival Analysis with 3 levels of censor

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!

Super Contributor
Posts: 271

Re: Survival Analysis with 3 levels of censor

[ Edited ]

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:-)

 

Solution
‎04-01-2017 05:43 PM
Occasional Contributor
Posts: 11

Re: Survival Analysis with 3 levels of censor

Thanks for your help! It also works!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 181 views
  • 1 like
  • 3 in conversation