In ILO data on unemployment, I am imputing missing values
Code:
* Impute unemployment  
sort countrycode year  
replace unemployment_wb = (unemployment_wb[_n-1] + unemployment_wb[_n+1])/2 if unemployment_wb == . & countrycode == countrycode[_n-1] & countrycode == countrycode[_n+1]  
replace unemployment_wb = (unemployment_wb[_n-2] + unemployment_wb[_n+2])/2 if unemployment_wb == . & countrycode == countrycode[_n-2] & countrycode == countrycode[_n+2]  
replace unemployment_wb = (unemployment_wb[_n-1] + unemployment_wb[_n+1])/2 if unemployment_wb == . & countrycode == countrycode[_n-1] & countrycode == countrycode[_n+1]  
replace unemployment = (unemployment[_n-1] + unemployment[_n+1])/2 if unemployment == . & countrycode == countrycode[_n-1] & countrycode == countrycode[_n+1]  
replace unemployment = unemployment_wb if unemployment == . & unemployment_wb != .  
replace unemployment = (unemployment[_n-1] + unemployment[_n+1])/2 if unemployment == . & countrycode == countrycode[_n-1] & countrycode == countrycode[_n+1]   
replace unemployment = (unemployment[_n-2] + unemployment[_n+2])/2 if unemployment == . & countrycode == countrycode[_n-2] & countrycode == countrycode[_n+2]  
replace unemployment = (unemployment[_n-1] + unemployment[_n+1])/2 if unemployment == . & countrycode == countrycode[_n-1] & countrycode == countrycode[_n+1]
Whenever I impute a missing value, I want to add a flag...let's say I have a flag column (boolean), which should be TRUE for every imputed missing value. How could I go about achieving that?