Abstract
Introduction
One of the key functions of cancer registries is to report information on cancer incidence, mortality, and survival (Parkin 2008). For the reporting of cancer survival, it is usual to estimate net survival, which is the probability of being alive as a function of time since diagnosis in the hypothetical situation where it is impossible to die from anything other than the cancer under study (Pohar Perme, Stare, and Estève 2012). This enables comparisons between population groups that have differential other-cause mortality rates.
It is possible to estimate net survival using cause-of-death information obtained from death certificates and assigning whether a death was due to the cancer. However, using cause-of-death information is potentially problematic because of misclassification of cause of death (Percy, Stanek, and Gloeckler 1981) or not capturing deaths that were indirectly due to the cancer (Bright et al. 2020). Therefore, it is more common to use the relative survival framework, where the mortality in excess of that expected in a similar group in the general population is used (Dickman and Adami 2006). The expected mortality rates are stratified by age, calendar year, sex, and potentially other factors such as region or socioeconomic group.
In this article, we discuss the
When one compares survival between population groups, there may be differences in the age distribution and potentially other important factors. Therefore, it is usual to age-standardize to a common age distribution to allow a fair comparison between population groups with a different age distribution. It is also possible to standardize over other factors. Standardization can be performed in two ways: 1) traditional age standardization estimates survival in each age group and then takes a weighted average of the age group specific estimates; and 2) the individual weighting approach upweights or downweights individuals relative to a reference population (Brenner and Gefeller 1996). The different approaches generally give similar estimates, but the individual weighting approach is particularly useful with sparse data or when you want to standardize over many factors (Rutherford et al. 2020).
There are other commands to estimate net survival nonparametrically—namely,
The article is organized as follows: Section 2 describes the relative survival framework and the Pohar Perme estimator of net survival. Section 3 describes other measures in the relative survival framework, including crude probabilities of death and reference-adjusted measures. Section 4 describes the syntax of the
The relative survival framework
The relative survival framework attempts to estimate mortality due to the disease of interest (usually cancer) without using cause-of-death information. Instead, it estimates the mortality rate in excess of that expected by using expected mortality rates from the general population. These expected rates are nearly always stratified by age, calendar year, and sex and sometimes by other factors, such as region or socioeconomic status.
Let
Transforming to the survival function gives
To describe the estimation approaches, we need to provide some definitions. Let
The all-cause Nelson–Aalen estimate of the cumulative hazard is
Because this nonparametric estimate changes only at event times, the cumulative hazard in (3) is obtained in practice by summing over unique event times. However, we will keep the integral form to highlight some issues when estimating marginal relative survival.
To extend to relative survival, we need to add additional definitions.
The Ederer II method incorporates the difference in the observed and expected number of events.
The Ederer II method was used for many years, but Pohar Perme, Stare, and Estève (2012) showed that it is a biased estimator of net survival. This is because net survival is in the hypothetical world where you cannot die of other causes, but we are using real-world data to estimate it. In the hypothetical world, we would observe more events and have more people at risk at any time point
The number of events, the number of expected events, and the number at risk will all be upweighted.
In both the Ederer II and Pohar Perme estimators, there will be a decrease in the cumulative hazard at times when there is not an event. This means that the survival function will increase between event times and, unlike the Nelson–Aalen, is not strictly a step function. However, in practice, the function is evaluated at specific times, usually taken to be all unique survival times in the dataset, and thus the integral in (4) and (5) is replaced with a sum over the observed survival times with
Transformation from cumulative (excess hazard) can be done in two ways, either using a Kaplan–Meier (product integral) type approach or a Breslow/Fleming–Harrington type approach. The default is the Kaplan–Meier (product integral) approach, so to convert the Nelson–Aalen cumulative hazard to a survival function, we use
For comparisons between groups, it is usually essential to standardize by age group and sometimes other covariates, which is described in the following section.
When one compares population groups, it is usually necessary to standardize with a specific covariate pattern. This can be any covariate pattern, but commonly, this may just be standardization to a common age distribution. Traditional standardization estimates marginal relative survival separately within
Alternatively, the individual weighting approach described by Brenner and Gefeller (1996) upweights or downweights individuals relative to the reference population. For example, consider standardization over
The individual weighting approach can also be applied when estimating the all-cause cumulative hazard,
Other measures in the relative survival frameworks
Crude probability of death
The crude probability of death is analogous to the cause-specific cumulative incidence function in competing-risks settings (Geskus 2016).
The all-cause probability of death can be partitioned into the crude probability of death due to the cancer under study,
Note that the crude probability of death due to cancer depends on both the mortality rate due to cancer and the mortality rate due to other causes (through the all-cause survival function). Thus, if we observe differences when comparing different population groups, then it is unclear whether the differences are due to differential cancer mortality, differential other-cause mortality, or some combination of both.
The all-cause survival function can be estimated using (6) with the other ingredients to (8) and (9), obtained as follows:
The reason why net survival is the standard way of comparing survival in population-based cancer studies is that differences will be solely due to differential cancer mortality rates (under the standard assumptions). Reference-adjusted measures are a way of making all-cause survival and crude probabilities of death comparable. Reference-adjusted all-cause survival gives the all-cause survival that would be observed for the cancer cohort if they instead experienced a common reference standard expected mortality rate, instead of that assumed for the cohort. First, other-cause mortality is removed by calculating relative survival using the relevant expected rates for the cohort under study. Then, this is converted back to an all-cause measure using the reference expected mortality rates, which are common across the compared groups.
We need to introduce more definitions. Let
We now redefine the weights from (7) as
Using these weights in (5) gives a measure proposed by Sasieni and Brentnall (2016). This is a hypothetical measure that depends on the expected survival in the reference population and is designed to allow fair comparisons across population groups using an Ederer II-like estimate. It is acknowledged that interpretation is difficult, and thus Sasieni and Brentnall described it as a standardized relative survival index. When
Reference adjustment extends these ideas to all-cause survival and the crude probability of death. For all-cause survival, we extend (5) to
There are several special cases that can be derived from (12). If
Similarly, the crude probability of death due to cancer and other causes can be extended to reference adjustment. Rather than the all-cause survival being based on the Nelson–Aalen estimator, the reference-adjusted all-cause survival in (12) is used. Similarly, rather than use
The reference-adjusted crude probabilities of death due to cancer and other causes are
There is a choice over which reference to use for both standardization and the expected mortality rates. It is useful to consider these together and to make one of the population groups being compared the reference for both. For example, when one looks at temporal trends in survival, it is useful to standardize to the age distribution in the most recent calendar period and use the expected mortality rates from the same calendar period (Lambert et al. 2025). This makes the all-cause survival or crude probability of death for the most recent calendar period a factual estimate, with previous calendar periods being counterfactual to ensure fair comparisons. Similarly, if one population group is of specific interest, for example, in international comparisons of cancer survival and taking the perspective for one particular country, then it is sensible to provide a factual estimate for the country of interest, with other countries adjusted.
The stpp command
The stpp command estimates nonparametric estimates of marginal relative survival and related measures.
Syntax
Options
The following suboptions are available:
Stored results
In addition to the new variables created, the following matrices are returned with estimates evaluated at times given in the
Most of the time, we find it easier to output this information to a new frame using the
The genindweights command
The
Syntax
The reference population to standardize to is defined by using
Options
Examples
The five examples use data on women diagnosed with breast cancer in the Northwest region of England 1985–1990 with follow-up to the end of 1995. The event of interest is death from any cause. Covariates of interest include the effect of deprivation—defined in terms of the area-based Carstairs score and age at diagnosis. There are five deprivation groups ranging from the least deprived (most affluent) to the most deprived quintile in the population. In this article, we restrict analysis to the least (
The data can be loaded and
There are 7,452 women included in the analysis. Follow-up has been restricted to 10 years using the
In any relative survival analysis, the expected rates (or survival probabilities) need to be merged in. For the nonparametric measures, this information is needed at unique time points, and
The listing shows the expected rates and expected one-year survival probabilities for women aged 71–75 in 1995 for the least and most deprived groups.
Example 1: Simple use of stpp
An initial use of stpp is to estimate marginal relative survival in the two deprivation groups.
The output lists marginal relative survival at 1, 5, and 10 years, showing that women living in more deprived areas have lower survival.
A brief explanation of the syntax. The expected rates are stored in a dataset with the filename given after
The corresponding plot can be seen in figure 1. This shows that women living in the more deprived areas have lower relative survival over the whole of the 10 years of follow-up. The code used to produce the graph can be saved by adding the

Marginal relative survival by deprivation group
The
In example 1, marginal relative survival was calculated separately in both groups. If there is a difference in the age distribution between the two groups, then this could partially explain the observed difference in survival.
The output below compares the age distribution in five age categories between the two deprivation groups.
There is a higher proportion of older women in the most deprived group, and because survival tends to be worse in older age groups, this could partially explain the differences. We will use age standardization to force the same age distribution on both groups. We will first apply the age distribution defined in the International Cancer Survival Standard (ICSS) (Corazziari, Quinn, and Capocaccia 2004). This applies weights of 0.07, 0.12, 0.23, 0.29, and 0.29 in the five age groups defined in the table above.
In the code for
The estimates of marginal relative survival are slightly lower than those seen in example 1 because the ICSS age distribution is older than that actually observed, so we are giving more weight to age groups with lower survival.
An alternative way to age-standardize is to use individual weights where each individual is upweighted or downweighted relative to the reference population. To calculate the individual weights, we can use the
This has calculated the weights, which can then be passed to
The individual weights are passed to
The standardized estimates are very similar to those obtained when using traditional age standardization. We tend to favor standardization using individual weights because they work better with sparse data and when there are many categories to standardize over.
Example 3: Reference weights based on a subset of data
In example 2, we used an external age standard. It can also be useful to define the reference age distribution using a particular subgroup in the study population. For example, this can be a recent calendar period when investigating temporal trends or a specific group of interest. Here we will use the age distribution in the most deprived group as the reference age distribution. To do this, we use the
The output shows the observed and reference proportions in each age group together with the individual weights. Because we are using the most deprived group for the reference age distribution, the observed and reference weights are identical for this group, and thus the individual weights are equal to 1. In the least deprived group, there are higher observed proportions for the two youngest age groups compared with the reference, so individual weights are less than 1. In the three oldest age groups, there is a lower observed proportion compared with the reference, so the individual weights are greater than 1.
These individual weights can be passed to
Note that because the weights for most deprived group are equal to 1, the estimates of marginal relative survival are identical to the unadjusted estimates in example 1. The estimates for the least deprived group have changed because they have been age standardized to the age distribution of the most deprived group.
Rather than use a specific subgroup as the reference, we may want to use the combined age distribution. This can be achieved as follows:
In addition, we used the
Example 4: Alternative measures
In this example, we show how
The different probabilities are plotted in figure 2. The all-cause probability of death is easiest to interpret and simply gives the probability of being dead from any cause as a function of time and is equivalent to what would be obtained using

Net, all-cause, and crude probabilities of death for the least and most deprived groups
Because we used the
Note that confidence intervals have also been calculated but are not shown.
The estimates shown above and in figure 2 are unadjusted. We can standardize in the same way as examples 2 and 3 using individual weights. We will make the most deprived group the reference group as before.
(
Now we just add the
The estimates at 1, 5, and 10 years are listed below.
Because the most deprived group is the reference group, the estimates have not changed compared with the unadjusted estimates for this group. The estimates for the least deprived group have changed because they are now age standardized to the age distribution of the most deprived group.
This example uses the
We create a separate file for the reference-expected mortality rates.
Only rows where
We will make the most deprived group the reference group for age standardization as in previous examples.
We now run
The
This output gives the Sasieni and Brentnall estimates. This measure can be thought of as being similar to an Ederer II estimator, but the inclusion of the reference-expected rates removes dependency on potentially different expected mortality rates. For the most deprived group, the estimates are the same as those obtained by using the
By adding the
To see the differences to the all-cause estimates calculated in example 4, figure 3 shows the nonreference-adjusted and reference-adjusted estimates for the two groups. All estimates are age standardized to the age distribution in the most deprived group. Because we have used the most deprived group as the reference for both the age distribution and expected mortality rates, the nonreference-adjusted estimates and the reference-adjusted estimates are identical for this group (and would also be identical to nonstandardized estimates). Because the most deprived group has higher expected mortality rates, we can see their impact on them being used as the reference rates for the reference-adjusted measures for the least deprived group. The all-cause survival increases because we are applying a higher other-cause mortality rate. The crude probability of death has decreased because increasing the expected mortality rate would mean that individuals have a higher chance of dying from other causes before they would die from their cancer. A key point is that the differences in the reference-adjusted measures are not now due to differential other-cause mortality because the common reference expected rates are being applied.

Net, all-cause, and crude probabilities of death for the least and most deprived groups. The darker lines are nonreference adjusted, and the lighter lines are reference adjusted. All estimates are age standardized to the age distribution in the most deprived group.
We have demonstrated the usefulness of the
There are several extensions that there has not been room to show. First,
Supplemental Material
sj-txt-2-stj-10.1177_1536867X261425755 - Supplemental material for The stpp command for marginal relative survival and related measures
Supplemental material, sj-txt-2-stj-10.1177_1536867X261425755 for The stpp command for marginal relative survival and related measures by Paul C. Lambert and Mark J. Rutherford
Supplemental Material
sj-dta-1-stj-10.1177_1536867X261425755 - Supplemental material for The stpp command for marginal relative survival and related measures
Supplemental material, sj-dta-1-stj-10.1177_1536867X261425755 for The stpp command for marginal relative survival and related measures by Paul C. Lambert and Mark J. Rutherford
Footnotes
Acknowledgments
The research presented in this manuscript was supported by the Swedish Cancer Society (Cancerfonden) and the Swedish Research Council (Vetenskapsrådet) and by the National Institute for Health and Care Research (NIHR) Applied Research Collaboration East Midlands and NIHR Leicester Biomedical Research Centre. Mark J. Rutherford is a coinvestigator of the NIHR Policy Research Unit on Cancer Awareness, Screening and Early Diagnosis (NIHR206132). The views expressed are those of the authors and not necessarily those of the NIHR or the Department of Health and Social Care.
8
To install the software files as they existed at the time of publication of this article, type
A more recent version of the command may be available from the Statistical Software Components Archive by typing
About the authors
Paul C. Lambert is a biostatistician based at the Cancer Registry of Norway in Oslo, Norway, and a visiting professor of biostatistics at Karolinska Institutet in Stockholm, Sweden. He is a longtime Stata user who has written various commands, including
Mark J. Rutherford is a professor of biostatistics at the University of Leicester, UK. He is a longtime Stata user and has a keen interest in applying survival methods in Stata, particularly for population-based cancer data.
References
Supplementary Material
Please find the following supplemental material available below.
For Open Access articles published under a Creative Commons License, all supplemental material carries the same license as the article it is associated with.
For non-Open Access articles published, all supplemental material carries a non-exclusive license, and permission requests for re-use of supplemental material or any part of supplemental material shall be sent directly to the copyright owner as specified in the copyright notice associated with the article.
