What is new• When developing a prognostic model (that aims to produce accurate probabilities of the outcome in case the patient is not treated) using data from a randomised trial in which individuals from one arm do not receive treatment, restricting the analysis to untreated individuals may be a suitable strategy. However, removing all patients in the treatment group will reduce the sample size, leading to greater uncertainty around predictions and also to prognostic models that are more prone to overfitting.• When developing a prognostic model using data from observational studies with treated patients, restricting the analysis to untreated individuals is not appropriate if treatment status depends on patient characteristics, including the predictors of the developed model.• For either randomised or observational studies, it is preferable to explicitly model treatment when developing a prognostic model.