In each of 8,000 schools I'd like to regress y on x1 and x2 and then generate the predicted value of y. The slopes and intercept may be different in each school. This is a little tricky, because as far as I can tell the predict command isn't byable. So I can't do this:
by school: reg y x1 x2
by school: predict y_predicted
This works on small datasets:
reg y i.school_id##(c.x1 c.x2)
predict y_predicted
but gets very slow if the number of schools is large. Any other ideas? I'm wondering if one of the fixed-effects commands would do the trick. Many thanks!
Paul