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!
Thanks for your help! It also works!
Is that working code?
I'm a bit uncertain what your question is here.
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;
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.
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!
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:-)
Thanks for your help! It also works!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.