Various questions similar in the archives:
for more details, search for -foreach-
and -levels-.
Also see
http://www.stata.com/support/faqs/data/foreach.html
Let's suppose your panels are defined by -company-
which takes integer values and to which value labels
are attached. The following indicates one line of
attack:
levels company, local(C)
gen resid = .
qui foreach c of local C {
regress y x1 x2 x3 if company == `c'
predict temp, res
replace resid = temp if company == `c'
drop temp
}
Nick
[email protected]
[email protected]
> I have a balanced panel dataset and I run individual
> regressions for each
> panel(almost 7000 panels for 14 years).
> I wish to save the residuals, standard errors of prediction
> and other -predict-
> statistics for each individual regressions, in a similar
> manner as -egen-
> does.
>
> I have searched the FAQ but didnt find something relevant,
> all suggestions are very welcome,
*
* 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/