- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Folks:
I'm trying to create Kaplan Meier plots and COX-PH modelling eventually. I have two questions for you since these two problems maybe related to a single error, I gut.
1. I defined the DURATION variable (time until death since diagnosis confirmed) and vital_status as shown below where vital_status=1 indicates the event of death. Based on my reading, I think defining
time duration*vital_status(0);
in the proc lifetest and proc phreg is the correct way. However, the resulting plot doesn't make sense because the medical condition concerned is highly fatal and the plot produce where vital_status(1) is close to the survival pattern. Why this could happen?
2. Also, the minimum and maximum survival time among the deceased are: 0 and 21. However, my plots show 70 which is the max follow-up time censored by 22004 which is the end of study date.
Could you please let me know your suggestions to address these problems?
Thank you for your time and help indeed.
IF DECEASED_DATE NE . THEN DEATH_DATE=DECEASED_DATE; ELSE
IF DECEASED_DATE=. THEN DEATH_DATE=22004;
DURATION=DEATH_DATE-CONFIRMED_DATE;
if state='deceased' then vital_status=1; else vital_status=0;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Cruise,
Your code snippets make sense to me. In particular, the TIME statement using vital_status(0) is correct.
I notice that your Kaplan-Meier plots don't indicate censored observations (i.e., those with vital_status=0). Did you specify the NOCENSOR option? It's not really important as this wouldn't affect the survival curves as such. It is correct that the x-axis spans the full range of both censored and uncensored survival times.
On the one hand, you say that "the medical condition concerned is highly fatal," but on the other hand, your PROC MEANS table states that only 48/2765=1.74% of the subjects died before end of follow-up, given that vital_status=1 means death. If this is true, the second KM plot looks right, but could be visually improved by increasing the minimum of the y-axis to a value >=0.9. Currently, the KM curves are "squeezed" into a small fraction of the vertical space.
To modify the y-axis as mentioned above, you can use the macros provided in https://support.sas.com/documentation/onlinedoc/stat/ex_code/142/templft.html. Once they are compiled, you can submit something like
%ProvideSurvivalMacros
%let yOptions = label="Survival"
linearopts=(viewmin=0.95 viewmax=1
tickvaluelist=(.95 .96 .97 .98 .99 1));
%CompileSurvivalTemplates
before your PROC LIFETEST step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Reeza I'll greatly appreciate your help on this issue, if your time allows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much.
Yes, i had nocensor option before. Is showing censored observations a good practice? Plot attached the censored observations now. Sorry for a confusing statement on the fatality. I guess that had it's aspect of being rapidly fatal among old people with a severe co-morbidity in mind when i wrote that. Which means then vital_status(0) is correct. The macro worked like a charm in combination with a snipped you provided. There are some cosmetic issues to enlarge the font size of the axis labels and reduce the plot dimension. Which seems that the link below has the instruction for.
Thanks again!
proc lifetest data=pti3(where=(sex ne ' '))
plots=survival(test atrisk);
time duration*vital_status(0);
strata sex;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Cruise wrote:
(...) Is showing censored observations a good practice?
I think it's quite common (which is why it's the default in the PROC LIFETEST KM plot). However, your data is special in that the proportion of censored observation is very large, yet these observations are concentrated on comparably few discrete points in time. As a consequence, almost all times are marked as censored and each "censored" symbol (plus sign) represents a varying, substantial number of observations. Hence, the information gained from the symbols is limited. So it's good to have the additional information from the displayed numbers of patients at risk.
Great to see the plots with the improved y-axis!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Cruise,
Your code snippets make sense to me. In particular, the TIME statement using vital_status(0) is correct.
I notice that your Kaplan-Meier plots don't indicate censored observations (i.e., those with vital_status=0). Did you specify the NOCENSOR option? It's not really important as this wouldn't affect the survival curves as such. It is correct that the x-axis spans the full range of both censored and uncensored survival times.
On the one hand, you say that "the medical condition concerned is highly fatal," but on the other hand, your PROC MEANS table states that only 48/2765=1.74% of the subjects died before end of follow-up, given that vital_status=1 means death. If this is true, the second KM plot looks right, but could be visually improved by increasing the minimum of the y-axis to a value >=0.9. Currently, the KM curves are "squeezed" into a small fraction of the vertical space.
To modify the y-axis as mentioned above, you can use the macros provided in https://support.sas.com/documentation/onlinedoc/stat/ex_code/142/templft.html. Once they are compiled, you can submit something like
%ProvideSurvivalMacros
%let yOptions = label="Survival"
linearopts=(viewmin=0.95 viewmax=1
tickvaluelist=(.95 .96 .97 .98 .99 1));
%CompileSurvivalTemplates
before your PROC LIFETEST step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
KM plot stratified by comorbidity (0,1) looks weird. But it makes sense since all death cases had a comorbidity condition. Please, let me know if you see something wrong in the plot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Cruise wrote:
KM plot stratified by comorbidity (0,1) looks weird. But it makes sense since all death cases had a comorbidity condition. Please, let me know if you see something wrong in the plot.
The plot looks correct. Maybe, for a minor improvement, a label (such as "Comorbidity") and a format (e.g.: "No", "Yes") for variable comorb and an x-axis label in mixed case would be good.
Not "all death cases had a comorbidity condition" (only 19 out of 48), but all subjects with a comorbidity condition died during the study.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content