Hello,

The data I am using is shown below. With this data I want to do a fixed effects regression, which is specified as follows:
CAR = a + b * beta + (industry x year Fixed effect)

I tried to do this by running the following code:
destring beta, replace
gen effectvar = year + beta
xi: reg CAR beta i.effectvar, vce(robust)

However, since the data contains 5000 observations over 40 years and 200 different industries and more variables are added in the regression later on, this seems very inefficient.

My question is whether the generated effectvar is able to capture the fixed effect as used in the regression, and whether there might be a more efficient way to do this regression where lesser dummy variables are created?


----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float beta str3 industry float(year CAR)
 .5329815 "679" 2011    .07553425
 .5329815 "679" 2013  -.032351222
 .5329815 "679" 2014  -.012514216
 .5329815 "679" 2014    -.0102148
 .5329815 "679" 2017   .003934517
 .7194424 "679" 2018    .03912193
 .8633259 "495" 2001   -.07463881
 .8633259 "495" 2005   -.13588685
 .8633259 "495" 2007    .04205769
 .8633259 "495" 2010    .01612598
 .8633259 "495" 2010  -.023594247
 .8633259 "495" 2011  -.019080525
 .8633259 "495" 2011   .027970703
 .8633259 "495" 2018   .014113883
 1.241463 "737" 2003    -.1861773
1.1609539 "382" 2005    .12610866
1.1609539 "382" 2006    .05358758
1.1609539 "382" 2008  -.010328552
1.1609539 "382" 2010   .030903555
1.1609539 "382" 2012 -.0004564476
1.1609539 "382" 2014    .03671289
1.1609539 "382" 2015    .04250077
1.1609539 "382" 2017  -.021748854
 .9447357 "507" 2010    .03452225
1.0769428 "349" 1994  -.027790343
1.0704867 "349" 2008   .030046886
1.0769428 "349" 2010    .13527417
1.0636841 "349" 2017    .05493223
1.0769428 "349" 2018    .10630278
 .9407231 "262" 2001   -.09455431
1.0062736 "138" 2000     -.109444
 1.241463 "737" 2017   -.19824477
 1.241463 "737" 2009  -.074328855
 1.241463 "737" 2003    -.3283806
 1.241463 "737" 2009   .019634387
 1.241463 "738" 2011    .10980153
 1.241463 "738" 2012    .10906418
1.0698786 "738" 2012   -.00966291
1.0698786 "738" 2013   .022634346
1.0698786 "738" 2013    .12872584
1.0698786 "738" 2014   -.03852171
1.0698786 "738" 2015    -.1069046
1.0698786 "738" 2016   .006813351
1.0698786 "738" 2016    .08716253
1.0698786 "738" 2017   -.01403843
 .3051328 "603" 1999   .014417864
 .3051328 "603" 2000    .04092802
 .3051328 "603" 2000   .009458303
 .4518907 "603" 2001   -.04515529
 .3051328 "603" 2002   -.10425451
 .4518907 "602" 2006  -.025753465
 .3051328 "602" 2006   -.02972457
 .3051328 "602" 2009   -.01236371
 .4518907 "602" 2010  -.009794697
 .4518907 "602" 2010   -.06907369
 .4518907 "602" 2015   -.03092849
 1.241463 "738" 2003    .10483425
 .5329815 "679" 2001   .006464713
 1.013634 "679" 2009 -.0012903254
 .5329815 "679" 2015   .018739196
.57012355 "679" 2018    .01604418
 .8256992 "541" 2004   -.04945724
 .9945634 "282" 1992    .15382983
 .9945634 "282" 1999    .03192229
 .8674936 "632" 2001    .01309997
 .8674936 "632" 2002   -.07672545
 .8674936 "632" 2002   -.12093623
 .9300295 "632" 2002   .014655202
 .8674936 "632" 2004  -.003816037
 .8674936 "632" 2004    .02076709
 .8674936 "632" 2005  -.022853304
 .8674936 "632" 2006   -.04112237
 .4518907 "602" 2002   -.07979991
 .8653597 "602" 2002    .03939068
 .4518907 "602" 2002   -.06108689
 .6544926 "602" 2004   .034014862
 .4518907 "602" 2004   .006055487
 .3051328 "602" 2006  -.011582783
 .4518907 "602" 2007 -.0036494704
  .640612 "602" 2010  -.017799318
 .4518907 "602" 2010  -.007669926
 .4518907 "602" 2011    .10398095
.57012355 "679" 1997  .0012813354
 .8841833 "581" 2015    .04096306
 .8841833 "581" 2017    .06427609
 .8841833 "581" 2018   -.00947358
 .8841833 "581" 1989  -.016752128
end
------------------ copy up to and including the previous line ------------------


Thanks in advance!

Best regards,
John Havelaar