Matches some earlier postings in spirit.
Note typo "for each" for "foreach".
Nick
[email protected]
[email protected]
>
> I'm new to replying to messages, so I hope I post this correctly.
> Anyway, here is a solution to the residual question that should work:
> If anyone has a more efficient solution, I would be
> interested in seeing
> it.
>
>
> levels year, local(Y)
>
> gen residual=.
>
> for each y of local Y {
> reg y x1 x2 x3 if year==`y'
> predict temp, residual
> replace residual=temp if year==`y'
> drop temp
> }
>
*
* 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/