BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SimRock
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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;

View solution in original post

8 REPLIES 8
Reeza
Super User

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

 

Perhaps with the failure plot? Or outcif? 

 

 

SimRock
Obsidian | Level 7
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
Reeza
Super User

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;
SimRock
Obsidian | Level 7
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
Reeza
Super User

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. 

SimRock
Obsidian | Level 7

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.


Capture.JPG
Reeza
Super User

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. 

SimRock
Obsidian | Level 7
Thank you. I will try it out and see.
Best
Thanks for your help

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 11914 views
  • 1 like
  • 2 in conversation