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

st: Re: series of overlapping regs


From   Christopher F Baum <[email protected]>
To   [email protected]
Subject   st: Re: series of overlapping regs
Date   Tue, 30 Sep 2003 06:09:33 -0400

On Tuesday, September 30, 2003, at 02:33 AM, John wrote:

I'm trying to perform a series of regressions pooled over adjacent years. For
example, I'd like to do:

regress y x1 x2 if (year == 1980 | year == 1981)
regress y x1 x2 if (year == 1981 | year == 1982)
regress y x1 x2 if (year == 1982 | year == 1983)

forv y=1980/2001 {
local y1 = `y'+1
reg y x1 x2 if ( year == `y' | year == `y1')
}

or, slightly more confusing but shorter, replace the two interior lines with
reg y x1 x2 if ( year ==`y' | year == `=`y'+1')

Kit

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