SPSS command: SPSS KM
Kaplan-Meier survival analysis in your browser
Kaplan-Meier estimates the probability of remaining event-free over time when some cases are censored, that is, followed for a while without the event happening.
Free · No account · Files stay on your device · Updated 18 October 2026
What it tells you
Crosstabs runs the SPSS KM procedure on your device: a survival table per group, mean and median survival with standard errors, quartiles, and log rank, Breslow and Tarone-Ware comparisons, optionally within strata.
- The cumulative proportion surviving after every distinct event time, with Greenwood standard errors.
- Median survival time with a confidence interval, and the 25th and 75th percentiles of survival time.
- A restricted mean survival time, limited to the largest observed time when that time is censored.
- Whether survival curves differ between factor levels, with three tests that weight early and late differences differently.
- For ordered groups, whether survival changes in a linear trend across the levels.
When to use it
Use it when
- Time-to-event data where not everyone has had the event yet: churn, relapse, device failure, time to first purchase.
- Describing survival for the whole sample or comparing a handful of groups without adjusting for covariates.
- Comparing groups within strata, such as treatment arms within study sites, using the pooled-over-strata tests.
Use something else when
- You need to adjust for several covariates or estimate hazard ratios: use Cox regression.
- Event times are only known by interval (month 0–6, 6–12) or the sample is very large: actuarial life tables summarise more compactly.
- No case is censored and you only need to compare typical times: a Mann-Whitney U test on the times is simpler.
- Data come from a complex survey design: use Complex Samples Cox regression, because sampling weights are not accepted here.
How to run it in Crosstabs
- 01
Open your data
Open a .sav, CSV or Excel file with one row per case and switch to Statistics mode. The file is parsed in your browser.
- 02
Choose Kaplan-Meier
In the Survival group, pick Kaplan-Meier (KM).
- 03
Set Time, Status and the event value
Choose the numeric Time variable and the Status variable, then pick the Value indicating the event has occurred; every other status value counts as censored. Cases with a negative time are excluded.
- 04
Add a factor and strata
Optionally choose a Factor (optional) to get one curve per level, and a Strata (optional) variable to compare the factor within each stratum.
- 05
Pick the comparisons
Under Compare factor levels, tick Log Rank (Mantel-Cox), Breslow (Generalized Wilcoxon) and Tarone-Ware; with three or more levels you can add Pairwise over strata and Linear trend for factor levels.
- 06
Choose the method
Keep Method at Enter, or pick Forward or Backward stepwise with the Conditional, LR or Wald removal statistic (entry uses the score statistic), set the probabilities for entry and removal, and tick any covariates that are Forced into the model.
- 07
Add a time-dependent covariate if needed
Type an expression in T_ (time) such as age * LN(T_) under Time-dependent covariate T_COV_ (optional). It is evaluated at every event time for each case at risk; survival tables and plots are then not shown, as in SPSS.
- 08
Choose a plot and run
Set Plot to Survival, One minus survival, Hazard (cumulative) or Log survival, declare any workspace weight as a frequency weight, and press Run.
Worked example
Computed by the Crosstabs engine from the synthetic data below when this page was built — not typed in.
Data
60 synthetic subscribers, 30 on a monthly plan and 30 on an annual plan. Time is whole months until cancellation (the event); accounts still active at 24 months or migrated earlier are censored. Times are drawn from exponential distributions with a fixed seed.
| Plan | Total N | N of Events | Censored N | Censored % |
|---|---|---|---|---|
| Annual | 30 | 17 | 13 | 43.3% |
| Monthly | 30 | 26 | 4 | 13.3% |
| Overall | 60 | 43 | 17 | 28.3% |
| Plan | Mean | Std. Error | 95% CI | Median | Std. Error | 95% CI |
|---|---|---|---|---|---|---|
| Annual | 13.88 | 1.73 | 10.48 – 17.28 | 16 | 5.71 | 4.81 – 27.19 |
| Monthly | 9.19 | 1.06 | 7.12 – 11.26 | 7 | 1.04 | 4.96 – 9.04 |
The mean is limited to the largest survival time when that time is censored. A median that is not reached is shown as —.
| Item | Chi-Square | df | Sig. |
|---|---|---|---|
| Log Rank (Mantel-Cox) | 5.802 | 1 | .016 |
| Breslow (Generalized Wilcoxon) | 1.475 | 1 | .225 |
| Tarone-Ware | 3.088 | 1 | .079 |
Test of equality of survival distributions for the different factor levels.
How to read it
Monthly subscribers cancel sooner: the monthly plan's median time to cancellation is 7 months against 16 for the annual plan, and the restricted mean is 9.2 versus 13.9 months. The log rank test gives χ²(1) = 5.80, p = .016. Breslow, which weights early event times more heavily, gives p = .225: the curves stay close in the first months and separate later in follow-up, which is exactly the pattern the log rank test is most sensitive to.
Output tables explained
- Case Processing Summary
- Total N, number of events, censored N and censored percentage for each curve and overall. A high censored share means the late part of the curve rests on few cases.
- Survival Table
- One row per distinct time: number at risk, events, censored, cumulative proportion surviving, its standard error, cumulative events and cases remaining.
- Means and Medians for Survival Time
- Mean and median survival with standard errors and 95% confidence intervals. A median that the curve never reaches is shown as —.
- Percentiles
- The 25th, 50th and 75th percentile survival times with standard errors; the 25th percentile is the time by which a quarter of cases have had the event.
- Overall Comparisons
- Chi-square, df and significance for each test of equal survival distributions; with strata the tests are pooled over strata.
- Pairwise Comparisons
- Each pair of factor levels tested with 1 df. The p values are not adjusted for multiple comparisons, so apply Bonferroni yourself if needed.
Assumptions and notes
- Censoring is non-informative: a case that leaves follow-up has the same future risk as those who stay.
- Survival probabilities do not depend on when a case entered the study (no cohort drift).
- Event times are measured precisely enough; many ties are handled correctly but blur the steps of the curve.
- A workspace weight must be declared as a frequency weight with whole-number values; sampling weights stop the procedure.
How the results are validated
On a 150-case reference file with frequency weights, the KM engine matches R survival 3.8.12 (survfit: survival, Greenwood SE, restricted mean and its SE) to 1e-10, R survdiff log rank (with and without strata) and lifelines 0.30.3 log rank, Breslow and Tarone-Ware to 1e-9, and an independent NumPy implementation of the SPSS KM algorithms for medians, percentiles, trend and pairwise tests to 1e-9. Validation evidence
Questions
Which test should I report: log rank, Breslow or Tarone-Ware?
Log rank weights every event time equally and is most powerful when one group's hazard is a constant multiple of the other's. Breslow weights early times by the number at risk, so it picks up differences that appear soon and fade. Tarone-Ware is a compromise. Decide before looking, and report the others as sensitivity checks.
Why is the median shown as —?
The curve never drops to 0.5, usually because many cases are censored before half have had the event. Report the percentiles that are reached, or the restricted mean, instead.
Why is the mean lower than I expect?
When the longest time is censored, the mean is restricted to that time, so it underestimates the true mean. Compare restricted means only between groups followed for similar lengths of time.
What does the Strata variable change?
Curves are estimated separately within each stratum, and the factor tests combine the within-stratum comparisons, so differences between strata (such as sites) do not masquerade as a factor effect.
Can I analyse patient data without uploading it?
Yes. The workspace reads the file and runs KM in your browser; the rows are not sent to Crosstabs servers.
Related procedures
- Life TablesSURVIVAL
- Cox RegressionCOXREG
- Complex Samples Cox RegressionCSCOXREG
- Mann-Whitney U TestNPAR TESTS /M-W
- Binary Logistic RegressionLOGISTIC REGRESSION
- Free SPSS alternative: full coverage list
Run Kaplan-Meier on your own data
Open a .sav, CSV or Excel file. Everything runs in your browser; the file never leaves your device.
SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.