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

st: R: re: running a foreach loop over a sequence of dates

From   "Carlo Lazzaro" <>
To   <>
Subject   st: R: re: running a foreach loop over a sequence of dates
Date   Thu, 4 Dec 2008 18:42:36 +0100

Dear Kit,
due to my gasping skills in Stata programming, I do hope that you are right!

Kind Regards,

-----Messaggio originale-----
[] Per conto di Christopher Baum
Inviato: giovedì 4 dicembre 2008 17.56
Oggetto: st: re: running a foreach loop over a sequence of dates

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 
  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)'

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
An Introduction to Modern Econometrics Using Stata:

*   For searches and help try:

*   For searches and help try:

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