Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Survival Analysis with 3 levels of censor

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-26-2017 09:31 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JacobSimonsen

03-28-2017 04:39 PM

Thanks for your help! It also works!

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Tawfiq

03-27-2017 12:37 AM

Is that working code?

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

03-27-2017 05:12 AM

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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Tawfiq

03-27-2017 07:41 AM

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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

03-27-2017 04:04 PM

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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Tawfiq

03-28-2017 07:43 AM - edited 03-28-2017 07:43 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JacobSimonsen

03-28-2017 04:39 PM

Thanks for your help! It also works!