turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- How to calcuate the cumulative incidence and the s...

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
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-02-2016 01:12 AM

Hi,

I was wondering whether someone could help me with the SAS code to directly compute the cumulative incidence and survival probability (over the course of follow-up)

proc phreg data=have;

class X;

model time*Y(0) = X;

run;

(X is binary)

Is there a way that SAS could directly output/compute the cumulative incidence of X. I know that survival probability = 1 - cumulative incidence but I am not sure how to readily get it from SAS.

Thank you

Accepted Solutions

Solution

11-02-2016
03:18 AM

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

Posted in reply to SimRock

11-02-2016 01:36 AM

Sure. This will generate three datasets that will have various calculations. You can use any of the three to get the numbers you desire. You may have to do some calculations to get it exactly the way you want it.

```
proc lifetest data=Males method=lt intervals=(0 to 15 by 1)
plots=(survival(f)) outsurv=survival_data;
time Years*Censored(1);
freq Freq;
ods output failureplot=option1 LifetableEstimates=option2;
run;
```

All Replies

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

Posted in reply to SimRock

11-02-2016 01:19 AM

Are you sure you want proc phreg and not proc lifetest?

Perhaps with the failure plot? Or outcif?

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

Posted in reply to Reeza

11-02-2016 01:21 AM

I will take anything that can compute it for me. Thank you for you prompt reply. I do not know how to get it in proc lifetest or the other procedures you mentioned. Could you share some codes with me

Solution

11-02-2016
03:18 AM

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

Posted in reply to SimRock

11-02-2016 01:36 AM

Sure. This will generate three datasets that will have various calculations. You can use any of the three to get the numbers you desire. You may have to do some calculations to get it exactly the way you want it.

```
proc lifetest data=Males method=lt intervals=(0 to 15 by 1)
plots=(survival(f)) outsurv=survival_data;
time Years*Censored(1);
freq Freq;
ods output failureplot=option1 LifetableEstimates=option2;
run;
```

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

Posted in reply to Reeza

11-02-2016 01:49 AM

Thank you. The freq Freq does not seem to work on my SAS 9.4. It says variable FREQ not found.

Also, do you know how to output the confidence interval as well. Thank you so mcuh

Also, do you know how to output the confidence interval as well. Thank you so mcuh

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

Posted in reply to SimRock

11-02-2016 01:55 AM

You only need freq if each value represents multiple records. The MALES dataset is available in the documentation for PROC LIFETEST under examples. Check the outputs. One of the datasets has CI but again you may need to 1- survival CI to get the values you want.

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

Posted in reply to Reeza

11-02-2016 02:25 AM

Okay. thank you. Got it.

Now my other problem is that it does not give me the expected results when I calulate it by.

I have 9 time points, 53026 events and 98230 individuals. There are no lost-to followup or competing risks. I have attached a snapshot of my data. When I calculate it manually, I get Survival =.0.46 and cumulative incidence=0.54 (i.e. 53026/98230) but when I use proc lifetest I get Survival=0.48 and cumulative incidence=0.52. I am just wondering whether I am making a mistake in my SAS code.

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

Posted in reply to SimRock

11-02-2016 02:50 AM

Examine the METHODS option. There are several methods for doing calculations.

You have a lot of observations but only 9 time points, or 9 points of interest.

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

Posted in reply to Reeza

11-02-2016 03:18 AM

Thank you. I will try it out and see.

Best

Thanks for your help

Best

Thanks for your help