When using observational data, quantifying the effect of treatment duration on survival outcomes is not straightforward because only people who live for a long time can receive treatment for a long time. This problem doesn’t apply to randomised trials because people are classified based on the treatment duration they are assigned, rather than the treatment duration that they achieve. This approach accepts that dead people do not deviate from their assigned treatment strategy. By transferring this insight to the analysis of observational data, we can follow three steps to estimate the effect of treatment duration from observational data without the bias of naive comparisons between long term and short term users. The first step is cloning people to assign them to multiple treatment strategies. The second step is censoring clones when they deviate from their assigned treatment strategy. The third step is performing inverse probability weighting to adjust for the potential selection bias introduced by censoring. The procedure can be used to compare any treatment strategies that are sustained over time. Cloning, censoring, and weighting eliminates immortal time bias in the estimates of absolute and relative risk, which helps researchers focus their attention on other biases that may be present in observational analyses and are not so easily eliminated.