Bookmark and Share

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


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

st: generate regression coefficients as varaibles


From   Nahla Betelmal <nahlaib@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: generate regression coefficients as varaibles
Date   Wed, 9 Jan 2013 18:30:41 +0000

Dear Statalist helpers,

I am applying a cross sectional regression for 37 industries (i.e.
dind) over 11 fiscal years. I need to
extract the coefficients of each industry/year to substitute in a sub-sample.

I tried this loop but it is not working:

gen coefficientCon=.
forvalue y= 2001/2012{
reg Wscaled Wone Wscaled_ch  WPPE if  dind1 & datayearfiscal==`y'
scalar bvar=_b[_cons]
gen bvar=_b[_cons] if datayearfiscal==`y'
replace coefficientCon= bvar if datayearfiscal==`y'
drop bvar
}

the out put I hope to get is silmilar to this in the edit file

 year       industry        coefficientCon    coefficientb1       coefficientb2
2001         dind1            0.2324                1,4356             8.98
2002         dind1            0.654                   1.445              3.98
.
.
2011
2001        dind2              0.343                 .4344               2.3434
.
.
.


Thank you,

Best regards

Nahla
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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