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/