Dear friends, I need a little help to solve a calculation.
I have a panel database (cs and ts), and for one variable, say "x", I need to calculate the following formula:
y = summation_(i= t-2 to t) of (1/3)* abs[( x_i - x_i-1 )/ x_i-1 ]
In other words, "y" is the three-year average variation in % of "x". I would get a new column for each firm-year data. Could anybody help me? Thanks in advance!
D.
*
* 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/