Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: -hpfilter- question


From   Giorgio Ricchiuti <ricchiuti.g@tiscali.it>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: -hpfilter- question
Date   Fri, 13 Feb 2004 13:13:59 +0100

Thank you Nick, 
should I put your programm in my do file directly? 
thanks a lot 
Giorgio  

----- Original Message ----- 
From: "Nick Cox" <n.j.cox@durham.ac.uk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Friday, February 13, 2004 1:01 PM
Subject: st: -hpfilter- question


> Giorgio Ricchiuti 
> 
> > I have to apply the Hoddrick-Prescott Filter Command to my Panel. 
> > Unfortunately this command does not permit to use "by". Please, 
> > Do you know how I can deal with this problem? I have 143 countries. 
> > So create 143 variables and then merge them takes quiet long time. 
> 
> Something like this may help. 
> 
> tsset country year 
> 
> gen hppredict = . 
> 
> levels country, local(C) 
> qui foreach c of local C { 
> hpfilter myvar if country == `c' 
> replace hppredict = H_myvar if country == `c' 
> drop H_myvar 
> } 
> 
> See also 
> http://www.stata.com/support/faqs/data/foreach.html 
> 
> Nick 
> n.j.cox@durham.ac.uk 
> 
> *
> *   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/


*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index