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   Christopher Baum <[email protected]>
To   [email protected]
Subject   st: re: running a foreach loop over a sequence of dates
Date   Thu, 4 Dec 2008 11:56:27 -0500

<>
Carlo said

Dear Martin, Kit and All Statalisters interested in Kit's forthcoming textbook, not later than this morning, the Italian official Stata dealer reported me April as an expected availability for this highly welcomed volume!

Unless shipping is by very slow boat, I think this is unduly pessimistic. I am assured that a final copy for my approval will be in hand shortly, and the Stata Press website http://stata-press.com/forthcoming.html lists January 2009 as the expected publication date. I would not think that sales to distributors overseas would be delayed that far behind the fulfillment of US sales.

As threatened, here is an example of "rolling your own":
capture program drop myregress
program myregress, rclass
version 10.1
syntax varlist(ts) [if] [in], LAGVar(string) NLAGs(integer)
regress `varlist' `if' `in'
local nl1 = `nlags' - 1
forvalues i = 1/`nl1' {
	local lv "`lv' L`i'.`lagvar' + "
}
local lv "`lv' L`nlags'.`lagvar'"'
lincom `lv'
return scalar sum = `r(estimate)'
return scalar se = `r(se)'
end

This command may then be used as the target of a -rolling- command. It will save two scalars per turn of the crank: the estimate of the sum of lag coefficients and its standard error.

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/



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