Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Foreach Command in Panel Data


From   "Degas Wright" <dwright@cornerstoneadvice.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Foreach Command in Panel Data
Date   Tue, 28 Sep 2010 13:21:41 -0400

To Statalist

I have panel data of 2000 tickers, excess returns (r) and various
fundamental variables such as earnings yield (ep), momentum(mom),
earnings revision (rev), over a 120 month period.  I am trying to use
the var command to develop a time series forecast for each individual
stock's excess return.  I realize that I have to analyze one ticker
(stock) at a time with the time series approach and assumed that using
the foreach command would work.

tsset
       panel variable:  xticker (unbalanced)
        time variable:  date, 2000m2 to 2009m6, but with gaps
                delta:  1 month


foreach xticker in dcm.dfa1.dat{
  2. tsset date
  3. var r ep mom rev
  4. }
repeated time values in sample
r(451);

However, I get the repeated time values in sample r(451).

Any assistance is appreciated.

Thank you,


Degas A. Wright, CFA
Chief Investment Officer
Decatur Capital Management, Inc.
250 East Ponce De Leon Avenue, Suite 325
Decatur, Georgia  30030
Voice: 404.270.9838
Fax:404.270.9840
Website: www.decaturcapital.com


*
*   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/


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