dataex city state estab_name estab_name2 GVKEY EXECID YEAR inj_hour dummy_recession_worked , count(30)
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Each firm has several establishments, firm (GVKEY) > establishment 1 (estab_name1) > establishment 2 (estab_name2)
I want to regress at the firm level (GVKEY) using reghdfe (so belong all establishments to each firm), what is the right code with fixed effects (firm and year fixed effect)?
Does the code at the bottom line is right ?
Should I sum by GVKEY and then regress?
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
bysort GVKEY: eststo: quietly reghdfe inj_hour dummy_recession_worked $firm_controls , $cluster absorb(GVKEY YEAR)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(inj_hour is dependent variable and dummy_recession_worked is independent variable)
On the other hand, what is the right code if I want to regress at the establishment 1 level? (several establishment 2 is included in estab1)
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str100 city str8 state str77 estab_name str62 estab_name2 str6(GVKEY EXECID) double YEAR float(inj_hour dummy_recession_worked) "Sidney" "NE" "ADC Digital Communications" "" "177267" "34262" 2007 .020279275 1 "Eden Prairie" "MN" "ADC Telecommunications Inc" "" "177267" "34262" 2007 .004152192 1 "Eden Prairie" "MN" "ADC Telecommunications Inc" "" "177267" "24546" 2008 .00136643 1 "Eden Prairie" "MN" "ADC Telecommunications Inc" "" "177267" "34262" 2010 .005478361 1 "THOMSON" "GA" "ADVANCE STORES COMPANY INC" "ADVANCE AUTO PARTS" "145977" "28101" 2003 .028846154 0 "THOMSON" "GA" "ADVANCE STORES COMPANY INC" "ADVANCE AUTO PARTS" "145977" "28099" 2004 .032467533 1 "ROANOKE" "VA" "ADVANCE STORES COMPANY INC" "ADVANCED AUTO PARTS" "145977" "32731" 2007 .01923077 1 "San Antonio" "TX" "AECOM" "" "147988" "37774" 2007 0 1 "SIMI VALLEY" "CA" "AEROVIRONMENT INC" "" "176362" "37909" 2011 .009368043 1 "SIMI VALLEY" "CA" "AEROVIRONMENT INC" "" "176362" "43628" 2011 .009368043 1 "Chicopee" "MA" "AGE Institute of Massachusetts Inc dba" "Williamsett Center East" "157355" "09105" 2004 .06012024 1 "Chicopee" "MA" "AGE Institute of Massachusetts Inc dba" "Williamsett Center East" "157355" "09105" 2005 .11219488 1 "Chicopee" "MA" "AGE Institute of Massachusetts Inc dba" "Williamsett Center East" "157355" "09105" 2006 .06610522 1 "ALLENTOWN" "PA" "AGERE SYSTEMS" "" "141845" "20559" 2002 0 1 "SANTA CLARA" "CA" "AGILENT TECHNOLOGIES, INC" "" "126554" "18350" 2011 .0036873526 1 "SAN JOSE" "CA" "ALIGN TECHNOLOGY, INC" "" "141384" "36420" 2011 .002467223 1 "DETROIT" "MI" "AMERICAN AXLE & MANUFACTURING, INC" "" "117861" "49887" 2011 .022468304 1 "LATHAM" "NY" "ANGIODYNAMICS, INC" "" "264387" "46668" 2011 0 0 "LATHAM" "NY" "ANGIODYNAMICS, INC" "" "264387" "46669" 2011 0 1 "LATHAM" "NY" "ANGIODYNAMICS, INC" "" "264387" "46673" 2011 0 0 "BLOOMINGTON" "MN" "ARAMARK" "" "144519" "23098" 2002 .05744221 0 "LUBBOCK" "TX" "ARAMARK SERVICES INC" "ARAMARK" "144519" "23098" 2002 .07878254 0 "LUBBOCK" "TX" "ARAMARK SERVICES INC" "ARAMARK" "144519" "23097" 2003 .08651829 1 "LUBBOCK" "TX" "ARAMARK SERVICES INC" "ARAMARK" "144519" "23097" 2004 .029571403 1 "FARMINGDALE" "NY" "ARAMARK SERVICES INC." "ARAMARK- Farmingdale State College" "144519" "23097" 2005 0 1 "FARMINGDALE" "NY" "ARAMARK SERVICES INC." "ARAMARK- Farmingdale State College" "144519" "23097" 2008 0 1 "DECATUR" "IL" "ARAMARK UNF & CAREER AP INC" "ARAMARK" "144519" "23097" 2002 .071821615 1 "DECATUR" "IL" "ARAMARK UNF & CAREER AP INC" "ARAMARK" "144519" "23098" 2003 .017610801 0 "DECATUR" "IL" "ARAMARK UNF & CAREER AP INC" "ARAMARK" "144519" "23097" 2004 .03859152 1 "DECATUR" "IL" "ARAMARK UNF & CAREER AP INC" "ARAMARK" "144519" "23097" 2005 .03012357 1 end
Each firm has several establishments, firm (GVKEY) > establishment 1 (estab_name1) > establishment 2 (estab_name2)
I want to regress at the firm level (GVKEY) using reghdfe (so belong all establishments to each firm), what is the right code with fixed effects (firm and year fixed effect)?
Does the code at the bottom line is right ?
Should I sum by GVKEY and then regress?
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
bysort GVKEY: eststo: quietly reghdfe inj_hour dummy_recession_worked $firm_controls , $cluster absorb(GVKEY YEAR)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(inj_hour is dependent variable and dummy_recession_worked is independent variable)
On the other hand, what is the right code if I want to regress at the establishment 1 level? (several establishment 2 is included in estab1)
