Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: RE: feeding optimal lag lengths in levinlin andipshinwithin a loop


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: RE: feeding optimal lag lengths in levinlin andipshinwithin a loop
Date   Wed, 22 Oct 2003 15:33:32 +0100

You would need to blank out the macro 
once in each loop: 

foreach k of varlist netprem disclm elr solv {
 	preserve
 	keep if variable == "`k'"
	local lags 
 	forvalues x = 1/19 {
 		sum lagrawnotrend if comcode == `x', mean
 		local lags "`lags' `r(mean)'" 
 	}
 	levinlin `k', lags(`lags')
 	restore 
}

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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