Hi everyone,
I have merged in variables with the regions and sub regions for each country into my dataset but in the merged in data there was only data for very few years per country and I want to fill in the rest of the observations so that I have the region value for every observation. To do that I used this code:
but it didn't work. What can I do instead?
In case what I want to do isnt clear, here is a picture of my dataset. What I want to do is fill in the missing values for region_un and a few other regional variables for every country.

Help would be awesome on this. Thanks!
I have merged in variables with the regions and sub regions for each country into my dataset but in the merged in data there was only data for very few years per country and I want to fill in the rest of the observations so that I have the region value for every observation. To do that I used this code:
local regionvars region_un region_un_sub region_wb
foreach var of regionsvars {
by CountryName: replace `var' = firstnm(`var')
}
foreach var of regionsvars {
by CountryName: replace `var' = firstnm(`var')
}
In case what I want to do isnt clear, here is a picture of my dataset. What I want to do is fill in the missing values for region_un and a few other regional variables for every country.
Help would be awesome on this. Thanks!
Comment