Statalist


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

st: Re: running a foreach loop over a sequence of dates


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: running a foreach loop over a sequence of dates
Date   Thu, 4 Dec 2008 07:42:29 -0500

< >
Beyond the problems with this pseudo-code, why write it in the first place? Why not just use -rolling-? Presumably Augusto really wants something other than just a huge logfile, and to save the stuff being produced in this loop, a little ado-file that saves the stuff he wants for each turn of the crank would probably be more useful.

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


On Dec 4, 2008, at 02:33 , Augusto wrote:


*** begin pseudo-code

foreach t in 1992q1/2000q4 {
       reg y L.y L.x if tin(1960q1, `t')
       reg y L.y L.x if tin(`=`t'-20', `t')
}

*** end pseudo-code

*
*   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   |   What's new   |   Site index