egen group=group(country industry)
sum group
local n=r(max)
gen e=.
forvalue i=1/`n' {
reg y x1 x2 x3 x4 if g==`i'
est store m_`i'
predict r if e(sample), res
replace e=r if e(sample)
drop r
}
drop g
egen group=group(country industry)
sum group
local n=r(max)
gen e=.
forvalue i=1/`n' {
reg y x1 x2 x3 x4 if g==`i'
est store m_`i'
predict r if e(sample), res
replace e=r if e(sample)
drop r
}
drop g