The sample size for a trial depends on the type I and type II error rates and on the minimum relevant clinical difference, all of which are known, and on the anticipated, but unknown, value of a measure of variation for the key response. This measure is the overall response rate when the key response is binomially distributed, or the residual variance in each treatment group when the key response is continuous and normally distributed. Since the true value of the measure is unknown, it must be guessed or estimated from previous trials. We describe approaches to determine an appropriate value for it, both before the trial begins and after it has begun, for use in calculating the final sample size. These approaches differ from previously described 'internal pilot' methods in not requiring unblinding of the treatment assignments in the trial. They preserve the power and do not affect the type I error rate materially. The approaches can be applied to longitudinal studies where the rate of change over time is the response of interest, and to group sequential trials.