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 
[email protected] 
*
*   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/