Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Rudy Hover <rudy.hover@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: predicting residuals in regression |
Date | Wed, 9 May 2012 17:53:51 +0200 |
I have panel on thousands of firms over 6 years. I want to regress using the foreach command: gen residuals=. levelsof permno, local(permnolist) forvalues y=1999/2006 { foreach f of local firmnolist { reg VarA VarB if firmno==`f' & year==`y' predict temp, residuals replace residuals=temp if firmno==`f' & year==`y' drop temp } } However I'm getting a variable residuals only containing missing values (.) What am I doing wrong? * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/