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
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;
Are you sure you want proc phreg and not proc lifetest?
Perhaps with the failure plot? Or outcif?
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;
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.
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.
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.