I have a panel dataset with the share of young people in a country(variable is named value) for 30 OECD countries for the years 1960-2050.
The data was only available at an annual frequency, but I want it at a semiannual frequency, so I want to expand and interpolate the data. The goal is to have the value for each country for every half year.
I have expanded the dataset and assigned the duplicates dupe=1 to keep track. Then I have generated a variable named year_half taking the value 1 for the originals (first half of the year) and the value 2 for the duplicates (second half of the year). Then I interpolate. The code is:
expand 2, gen(dupe)
gen year_half = 1 if dupe==0
replace year_half = 2 if dupe==1
bysort year : gen hdate = yh(year, year_half)
by year : replace value = . if dupe==1
ipolate value hdate, gen(linear) epolate
I don't get any error codes, but I don't get the right outcome either. The variable linear only has interpolated values for some of the observations (the rest are missing), and it does not seem to be corresponding to year_half, hdate or dupe. Does anyone know how to fix this?