# st: AW: Saving or generate variables for regression coefficients

 From "Martin Weiss" To Subject st: AW: Saving or generate variables for regression coefficients Date Wed, 21 Oct 2009 20:55:44 +0200

```<>

*************
clear*
set obs 20
gen industry=_n
gen industryalpha= /*
*/ rnormal()
expand 10
bys industry: gen firm=_n
gen firmalpha=rnormal()
expand 10
bys industry firm:  /*
*/ gen year=_n

//covariates
forv i=1/5{
gen x`i'=rnormal(0,`i')
}

//DGP
gen y=10+2*x1+3*x2+4*x3 /*
*/ -4*x4+5*x5+firmalpha+ /*
*/ industryalpha+rnormal()

compress

statsby, by(industry year)  /*
*/ clear : reg y x?

list, noobs  /*
*/ sepby(industry)  /*
*/ he(30)
*************

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Ferdinand
Siagian
Gesendet: Mittwoch, 21. Oktober 2009 20:51
An: statalist@hsphsun2.harvard.edu
Betreff: st: Saving or generate variables for regression coefficients

I mean industry not company. There are many companies in each industry.

So, I regress:

By industry year: Y X1 X2 X3 X4 X5

My question: if there are 20 industries with 10 years of data in each
industry, I will have 200 sets of coefficients. How do I save those data or
generate variables for those coefficients?

Thanks,
Ferdinand

______________________________________________________________________
Dear Statalist,

How can I save or generate variables for regression coefficients when I
regress data by company and year?

This is the command that I use:

By company year: regress Y X1 X2 X3 X4 X5

If there are 20 companies with 10 years of data each, I will have 200 sets
of coefficients. How do I save those data or generate variables for those
coefficients?

Thanks,
Ferdinand

*
*   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/

*
*   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/
```