Hi statalisters,
I’m a beginner for Stata, and I have just a problem with it. I want to do a cross-sectional time series analysis with command “arima” and imput the estimator of “AR L1. Coefficient” of every panel data into the datasheet with the help of “foreach” and “levelsof”.
My Data looks like this:
gvkey qtl eps
1 2003q1 ….
1 2003q2 ….
1 2003q3 ….
... …….
2 2003q1
2 2003q2
2 2003q3
…
gvkey: identify-Nr. of firms (panel variable, long)
qtl: quarter (time variable, float)
eps: earnings per share (dependent variable, float)
So I’ve tried:
- generate AR =.
tsset gvkey qtl
levelsof gvkey, local(levels)
foreach l of local levels {
arima eps if gvkey == `l', arima(1,0,0) sarima(0,1,0,4)
replace AR = _b[ARMA:L1.ar] if gvkey == `l'
}
But it doesn’t seem to work. Time series analysis (Arima) hasn’t been done and all of AR are still missing value.
I’m sure this is correct:
- arima eps, arima(1,0,0) sarima(0,1,0,4)
- replace AR = _b[ARMA:L1.ar]
I’ve tried it for data with one Observation (one gvkey)
I guess, there may be something wrong with foreach or levelsof, but I can’t find the error. Can anyone here give me any advice?
Any help would be greatly appreciated. Thanks in advance for your time.
I’m using Stata version 10.1 SE (Windows).
Best Regards
Hua Pan
University of Cologne
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
*
* 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/