I am trying to fill in some missing data with a previous year's data for that country and flag the imputation method. These two statements (I think) have the same if clauses but operate on a different number of observations. Can someone explain and help me get this aligned?
Thanks!
// Use last year's rcvd
sort country year
by country: replace rcvd_imputation = "Lagged received" if rcvd_tot==. & rcvd_tot[_n-1]!=. & year !=latest_year & do_not_fill!=1
sort country year
by country: replace rcvd_tot = rcvd_tot[_n-1] if rcvd_tot==. & rcvd_tot[_n-1]!=. & year !=latest_year & do_not_fill!=1
Thanks!
// Use last year's rcvd
sort country year
by country: replace rcvd_imputation = "Lagged received" if rcvd_tot==. & rcvd_tot[_n-1]!=. & year !=latest_year & do_not_fill!=1
sort country year
by country: replace rcvd_tot = rcvd_tot[_n-1] if rcvd_tot==. & rcvd_tot[_n-1]!=. & year !=latest_year & do_not_fill!=1
Comment