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]
Re: st: create a variable with estimated coefficients on dummies
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: create a variable with estimated coefficients on dummies
Date
Wed, 15 Aug 2012 21:08:07 +0200
On Wed, Aug 15, 2012 at 8:27 PM, Bernini, Michele wrote:
> I am programming a loop to execute the following operations:
>
> 1- estimate a regression on a big set of dummies (country-hs6 product categories)
>
> 2-create a variable with the estimated coefficients on the dummies. For each observation (row) the value of this variable should correspond to the coeff. on the dummy that assumes value 1 for that observation.
Sounds to me like you don't need a loop, it is just a matter of
predicting and than subtracting the constant:
*-------- begin example ----------
sysuse nlsw88, clear
reg wage i.occupation
predict coef
replace coef = coef - _b[_cons]
list occupation coef in 1/5, nol
*--------- end example -----------
Hope this helps,
maarten
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* 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/