- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help! It also works!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is that working code?
I'm a bit uncertain what your question is here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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:-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help! It also works!