The easiest way I can think is to use merge, suppose the data is A and assuming city appears once per year
tempfile B C D
drop _all
use A
keep if year == 2008
sort city
drop year
save `B'
use A
keep if year == 2009
sort city
merge city using `B', update replace
drop _merge
save `C'
use A
keep if year == 2010
sort city
merge city using `B', update replace
drop _merge
save `D'
drop _all
use A
keep if year == 2008
append using `C' `D'