- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure you want proc phreg and not proc lifetest?
Perhaps with the failure plot? Or outcif?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Also, do you know how to output the confidence interval as well. Thank you so mcuh
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Best
Thanks for your help