help stnet 
                                                                also see:  strs


stnet -- Estimating net survival


stnet using filename [if exp] [in range] [iweight=varname] , breaks(range) mergeby(varlist) diagdate(varname) birthdate(varname) [by(varlist) attage(newvar) attyear(newvar) survprob(varname) maxage(int 99) ederer2 standstrata(varname) list(varlist) format(%fmt) notables level(int) saving(filename[,replace]) savstand(filename[,replace])

stnet is for use with survival-time data; see help st. You must stset your data with time since entry in years as the timescale before using stnet; see help stset.

iweights are allowed; see help weights and see example using weights below. Weights must be specified as [iweight=varname] .


stnet estimates net survival as proposed by Pohar Perme, Stare and Estève (Biometrics 2011) by using a life tables approach. The command displays the results in life tables stratified by the variables specified in the by option. Optionally relative survival using the Ederer II method can be calculated. This command may be used also for period or hybrid analysis and to compute adjusted (weighted) estimates.

using filename specifies a file containing general population survival probabilities (conditional probabilities of surviving one year), typically stratified by age, sex, and calendar year. Age must be specified in one year increments (typically from 0 to 99) and calendar year in one year intervals. The file must be sorted by the variables specified in mergeby(). Default names for variables in this file are prob for the survival probabilities (see the survprob() option), _age for age (see the attage() option), and _year for calendar year (see the attyear() option). The maximum age is specified using the maxage() option (default is 99).


breaks(range) specifies the cutpoints for the lifetable intervals as range in the forvalues command.

mergeby(varlist) specifies the variables by which the file of general population survival probabilities is sorted.

by(varlist) specifies the life table stratification variables. One life table is estimated for each combination of these variables.

diagdate(varname) specifies the variable containing the date of diagnosis.

birthdate(varname) specifies the variable containing the date of birth.

attage(newvar) specifies the variable containing attained age (i.e., age at the time of follow-up). This variable cannot exist in the patient data file (it is created from the difference between date of diagnosis and date of birth plus follow-up time) but must exist in the using file. Default is _age.

attyear(newvar) specifies the variable containing attained calendar year (i.e. calendar year at the time of follow-up). This variable cannot exist in the patient data file (it is created form the date of diagnosis plus follow-up time) but must exist in the using file. Default is _year.

survprob(varname) specifies the variable in the using file that contains the general population survival probabilities. Default is prob.

maxage(int 99) specifies the maximum age for which general population survival probabilities are provided in the using file. Probabilities for individuals older than this value are assumed to be the same as for the maximum age.

ederer2 specifies that Ederer II relative survival estimates be calculated. Note that stnet calculates the observed survival by transforming the interval specific cumulative hazard. Therefore the results are not exactly equal to those obtained by using ltable and strs in the case of cohort design (Dickman 2010).

list(varlist) specifies the variables to be listed in the life tables. The variables start and end are included by default, but if only one of these is specified in the list option then the other is suppressed.

standstrata(varname) specifies a variable defining strata across which to average the cumulative survival estimate. Weights must be given by [iweight=varname].

format(%fmt) specifies the format for variables containing survival estimates. Default is %6.4f.

notables suppresses display of the life tables.

level(int) sets the confidence level; default is based on the value of the global macro S_level which, by default, takes the value 95.

saving[(replace)] saves in filename a data sets containing one observation for each life table interval.

savstand(filename[,replace]) saves in filename standardised estimates.

Example: Net survival (Pohar Perme and coll.) by sex

. stnet using lifetab, br(0(.0833333334)10) mergeby(_year sex _age) diagdate(dx) birthdate(bdate) by(sex)

Example: Ederer II estimates by sex

. stnet using lifetab, br(0(0.5)10) mergeby(_year sex _age) diagdate(dx) birthdate(bdate) by(sex) ederer2

Example: Estimation using a period approach

The approach is to first stset the data with calendar time as the timescale. For example, we might be interested in the time at risk between 1 January 2005 and 31 December 2007.

. stset datafu, fail(status==1 2) origin(dx) enter(time mdy(1,1,2005)) exit(time mdy(12,31,2007)) scale(365.241)

We then can use stnet in the usual manner to get net survival and Ederer II est > imates

. stnet using lifetab, br(0(0.083333334)10) mergeby(_year sex _age) diagdate(dx) birthdate(bdate) by(sex) ederer2

Example: Age-standardised estimates of net survival

To age-standardise using traditional direct standardisation we could specify the following command

. stnet using lifetab [iw=standwei], br(0(.083333334)10) mergeby(_year sex _age) diagdate(dx) birthdate(bdate) by(sex) standstrata(agegroup)

stnet first constructs life tables for each level of sex and agegroup then calculates age-standardised estimates for each sex by weighting the age-specific estimates using the weights specified in the variable standwei. The strata across which to average are defined using the standstrata(varname) option; a variable containing the weights (which must be less than 1) must exist in the data set and be specified using the iweight= option.

Standard errors are estimated using the approach described by Corazziari et al (2004).

Example: Saving estimates

Saving estimates is needed to graph net survival estimates

. stnet using lifetab, br(0(.083333334)10) mergeby(_year sex _age) diagdate(dx) birthdate(bdate) by(sex) saving(colonnetsurv,replace)


Net survival is the function of interest for cancer registries because it is the survival that we can measure if cancer is the only cause of death. Therefore it is suitable to compare cancer survival among different populations and to analyze survival trends. Pohar Perme and coll. shown that the correlation between cancer survival and other causes survival must be taken into account to properly estimate the net survival. They propose a method based on the inverse probability weights. For each individual weights are given by the inverse of its expected survival probability computed from the survival probabilities of the general population supplied in the using file. Danieli and coll. proven that the method proposed by Pohar Perme and coll. actually estimates the net survival.

In stnet we apply a life table approach for the estimation of the net survival. First we compute for each interval the cumulative weighted excess hazard given by Hw = k x (dw - d_hatw) / pyw.

where k is the length of the interval, dw is the weighted number of deaths, d_hatw is the weighted number of the expected deaths and pyw are the weighted person-years at risk. Then we transform it in the interval specific net survival by NS = exp(-Hw)

Finally the cumulative net survival is obtained by the product of the interval specific estimates.

Results produced by stnet have been checked by comparing them with rs.surv in relsurv R-package, written by Pohar Perme. As ancillary file the results of 1000 simulations are provided where bias and coverage probabilities of the estimates produced by stnet look in good agreement with the simulated net survival.


Enzo Coviello (


I wish to thank Mark Rutherford for making available the code for the simulations and for testing the command.


Pohar Perme M, Stare J, Estève J On estimation in relative survival, Biometrics 2012 Mar;68(1):113-20.

Danieli C, Remontet L, Bossard N, Roche L, Belot A. Estimating net survival: the importance of allowing for informative censoring Statistics in Medicine 2012 Apr 13;31(8):775-86

Dickman P. Standard errors of observed and relative survival in strs.

Corazziari I, Quinn M, Capocaccia R. Standard cancer patient population for age standardising survival ratios, European Journal of Cancer 2004;40:2307-16.

On-line: help for stset, strs, ltable