In difference in differences, a treatment is applied only to a qualified group at some time point. The qualification may be time-constant as in gender, or time-varying as in residential location. When the qualification is time-varying, there appear four groups: the newly qualified (in-movers), the already qualified (in-stayers), the newly disqualified (out-movers), and the already disqualified (out-stayers). A change in qualification may affect the response variable of interest even when the treatment effect is zero, which is an ‘untreated moving effect’. Also, when the treatment effect is not zero, it may be different across the four groups. The conventional difference in differences fails to remove untreated moving effects and ignores the possible treatment effect heterogeneity across the groups. This paper shows how to account for untreated moving effects and proposes ‘the effect on in-stayers’ as the main effect of interest. Our proposal can be implemented with least squares estimator for panel models or with nonparametric methods. An empirical analysis is provided using Korean data for the effects of the basic elder pension on health-care expenditure. Copyright © 2014 John Wiley & Sons, Ltd.