Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: calculation problem


From   west--@libero.it
To   "statalist" <statalist@hsphsun2.harvard.edu>
Subject   st: calculation problem
Date   Mon, 26 Nov 2007 22:08:39 +0100

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/



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