upper confidence interval limit are NA for median overall survival I have survival data set and had issue of getting upper 95 % confidence interval for median overall survival. I had observed other users had similar issue and I went through all suggestion. However, all these could not solve my issue. I hope experts here could help me. I have put all my data and some relevant code here in case you like to test.
library(tidyverse)
library(biostat3)
library(survival)
library(survminer)

Sur<- read.csv("Drug.csv", stringsAsFactors = TRUE)

## Find median survival time =====================

survfit(Surv(Surv_dd, Censor) ~ Treatment, data = Sur)  

survfit(Surv(Surv_dd, Censor) ~ Treatment, data = Sur)  # problem not getting upper confidence limit
Call: survfit(formula = Surv(Surv_dd, Censor) ~ Treatment, data = Sur)

                                      n events median 0.95LCL 0.95UCL
Treatment=drug A                      9      8   26.0      23      NA
Treatment=drug A & drug B (10_12_14) 10      5   36.0      29      NA
Treatment=drug A & drug B (15_17_19) 11      8   38.0      36      NA
Treatment=drug A & drug B (21_23_25) 10      9   38.5      34      NA
Treatment=drug B                      8      7   31.0      31      NA
Treatment=untreated                   9      9   22.0      21      NA


## Try another methods ==============

Median_Sur <- survfit(Surv(Surv_dd, Censor) ~ Treatment, 
                      data = Sur, conf.int=0.95, 
                      type = "kaplan-meier", 
                      conf.type = "plain")

print(Median_Sur)

Call: survfit(formula = Surv(Surv_dd, Censor) ~ Treatment, data = Sur, conf.int = 0.95, type = "kaplan-meier", conf.type = "plain")

                                      n events median 0.95LCL 0.95UCL
Treatment=drug A                      9      8   26.0      23      30
Treatment=drug A & drug B (10_12_14) 10      5   36.0      29      NA
Treatment=drug A & drug B (15_17_19) 11      8   38.0      32      NA
Treatment=drug A & drug B (21_23_25) 10      9   38.5      34      42
Treatment=drug B                      8      7   31.0      30      34
Treatment=untreated                   9      9   22.0      21      23

Also, if I would like to compare for difference in median overall survival between groups, what test should I use? Thank for your help. Have a great day.
Kind Regards,
Synat

 A: This is essentially an extension of the problem in calculating median survival from Kaplan-Meier curves when fewer than half of a group have experienced the event. Then you even get NA values for median survival itself. Here, you just don't have enough events at later times to get reliable upper CI. For example, your second group (Treatment=drug A & drug B (10_12_14)) just barely reached median survival, with 5 events out of 10 cases. It provides no information about the time to later events, so you can't get a finite upper CI.
You might consider trying to evaluate times to some higher survival quantile, like 75% survival, rather than median (50%) survival.
Comparing median survival times among Kaplan-Meier curves is surprisingly difficult. You are probably better off doing a Cox regression to compare relative hazards among treatments instead (which might also allow for median-survival estimates based on the shared baseline survival curve), or perhaps fitting a parametric model.
Note that you have fewer than 10 events per treatment, so that the results you get will probably be of low precision and might just come from overfitting.
