Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: predicting residuals in regression

From   Rudy Hover <>
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:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index