See [U] 11.4.3 and [U] 13.8 for further information on this approach...
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kit Baum
Sent: Monday, October 13, 2008 2:47 PM
To: [email protected]
Subject: st: re: calculating growth rates in a panel dataset
< >
Martin suggested
- bys id: g salesgrowth=(sales[_n]-sales[_n-1])/sales[_n-1]-
This works, but I spend some time every year when I lecture about
panel data explaining to students why it is a Very Bad Idea to do so.
bys id: g salesgrowth = D.sales/L.sales
or
bys id: g salesgrowth = log(D.sales)
is a much safer way to do this, as the time-series operators will
catch any issues with the time index (what if period 4 was not
recorded for a given firm?). It requires that the data be -xtset- or -
tsset-, and doing so will also catch some miscoding if the time index.
Best to have Stata look for such mistakes in the process of data
transformation. Very misleading results can be produced if you use
explicit subscripts and the observation is completely missing (not
Stata missing, but not recorded at all).
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/