hi, i would like to add missing values to adding the mean.
The missing values are mostly between 2012-2015,
my dataset is from 2002-2015, so the last 3 years are missing
i tried this:
bysort country year: egen var_all = mean(var)
but the missing values are not added :/
then i tried this:
replace var_all = (var_all[_n-1]+var_all[_n+1])/2 if var_all == .
The missing values are mostly between 2012-2015,
my dataset is from 2002-2015, so the last 3 years are missing
i tried this:
bysort country year: egen var_all = mean(var)
but the missing values are not added :/
then i tried this:
replace var_all = (var_all[_n-1]+var_all[_n+1])/2 if var_all == .

Comment