I have a panel dataset and i want to filter one of the series using the
Hodrick-Prescott filter. The problem is that for some countries the variable
that i have to filter has missing observations in a middle year (i.e i have
the observation from 1989 to 1994 and one missing on 1995 and then continues
again). I've ran the following do file:
sort codigo1
gen hpr=.
local i=1
while `i'<codigo1[_N] {
hpfilter rer if codigo1==`i' & rer~=.
replace hpr=H_rer if codigo1==`i'
drop H_
local i=`i'+1}
gen devhpr=rer-hpr
but when i got to the first country that have the missings in between i got
an error:
"gaps in the data"
do you know a way in which i could overcome this problem ?? or do you know
how could i identify the countries for which the missing values for my
variable are like this:
year variable
89 x89
90 x90
91 x91
92 .
93 x93
and so on...
THANK YOU IN ADVANCE...
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/