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 levinlinandipshinwithin a loop


From   "Dev Vencappa" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: RE: feeding optimal lag lengths in levinlinandipshinwithin a loop
Date   Wed, 22 Oct 2003 15:52:53 +0100

Nick 
 brilliant. The line
local lags
is exactly what was needed to make it work. It is now doing exactly what I want it to do. 

Many thanks for your help.

Dev

Dev Vencappa
School of Economics
University of Nottingham
University Park
Nottingham
NG7 2RD
U.K.
Tel : +44 (0)115 951 5608
Fax: +44 (0) 115 951 4159
>>> [email protected] 10/22/03 3:33 PM >>>
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/


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