## How to calcuate the cumulative incidence and the survival probability

Solved
Occasional Contributor
Posts: 18

# How to calcuate the cumulative incidence and the survival probability

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
Super User
Posts: 23,262

## Re: How to calcuate the cumulative incidence and the survival probability

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
Super User
Posts: 23,262

## Re: How to calcuate the cumulative incidence and the survival probability

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

Perhaps with the failure plot? Or outcif?

Occasional Contributor
Posts: 18

## Re: How to calcuate the cumulative incidence and the survival probability

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
Super User
Posts: 23,262

## Re: How to calcuate the cumulative incidence and the survival probability

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;``````
Occasional Contributor
Posts: 18

## Re: How to calcuate the cumulative incidence and the survival probability

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
Super User
Posts: 23,262

## Re: How to calcuate the cumulative incidence and the survival probability

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.

Occasional Contributor
Posts: 18

## Re: How to calcuate the cumulative incidence and the survival probability

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.

Super User
Posts: 23,262

## Re: How to calcuate the cumulative incidence and the survival probability

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.

Occasional Contributor
Posts: 18

## Re: How to calcuate the cumulative incidence and the survival probability

Thank you. I will try it out and see.
Best