Dear Stata Users,

Can you please help me with the following issue. How can I include interactions of regressors with year and industry indicators? (below is a data sample) For instance, I can run a simple regression with industry and year fixed effects such as:

Code:
reghdfe y x1, ab( year industry) vce(cluster gvkey)




And then include interactions such as:

Code:
reghdfe y x1 industry_dummies*x1 year_dummies*year, ab( year industry) vce(cluster gvkey)



Where I create dummies for years and industries and multiply them by x1. However, is there any faster way to do this?


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long gvkey double year float(industry y x1)
1013 2004 36    .02025178  .0017934382
1013 2005 36    .01834061   .001478527
1013 2006 36    .03851444   .001693497
1013 2007 36    .04694377  .0002120525
1013 2008 36    .06268657 .00017819204
1013 2009 36    .06320142 .00007802839
1013 2010 36    .05138607  .0002062628
1021 2004 12    .13157895            0
1021 2005 12    .16284987  .0017593985
1021 2006 12    .05694761  .0006877193
1021 2007 12    .06666667  .0000269319
1021 2008 12    .04166667            0
1021 2009 12    .04883721            0
1034 2004 13   .023106094            0
1034 2005 13    .01914973            0
1034 2006 13    .03370358            0
1034 2007 13    .05226243            0
1050 2004 21   .020175345            0
1050 2005 21    .02314507            0
1050 2006 21   .032539222            0
1050 2007 21    .05564125            0
1050 2008 21    .05464029            0
1050 2009 21 .00016785566            0
1050 2010 21    .04265323            0
1056 2004 37    .03122397            0
1056 2005 37    .04515184            0
1056 2006 37    .05168263            0
1056 2007 37    .05800625            0
1072 2004 36    .04696904            0
1072 2005 36    .04519971            0
1072 2006 36     .0547266            0
1072 2007 36    .05451386            0
1072 2008 36    .04114308            0
1072 2009 36    .01954534            0
1072 2010 36    .02967712            0
1072 2011 36     .0519489            0
1072 2012 36    .05715056   .000991069
1072 2014 36    .03581401            0
1072 2015 36   .067871794            0
1072 2016 36    .09233658            0
1072 2017 36    .09410735            0
1078 2004 12    .03068676  .0006918203
1078 2005 12    .04929695   .002387661
1078 2006 12    .06197115  .0022499776
1078 2007 12    .08966178   .002389777
1078 2008 12    .04859708  .0026790614
1078 2009 12   .035940412  .0020468947
1078 2010 12    .03393426   .001842625
1078 2011 12    .04616836  .0019611246
1078 2012 12    .05343837   .003283143
1078 2013 12     .0501458  .0015666197
1078 2014 12    .04337592  .0011311359
1078 2015 12    .04278075   .006343734
1078 2017 12   .036150914   .001592523
1094 2006 41    .04391827            0
1094 2007 41     .0402713            0
1094 2008 41    .04572888            0
1104 2004 17    .05108499            0
1104 2005 17    .09641174            0
1104 2006 17     .0802779            0
1104 2007 17     .0746688            0
1104 2008 17     .0549542            0
1104 2009 17     .0574074            0
1104 2010 17     .1378175            0
1104 2011 17    .14363714            0
1104 2012 17    .06909548            0
1104 2013 17     .2367589            0
1104 2014 17     .0937124            0
1104 2015 17    .05515457            0
1104 2016 17    .06208032            0
1104 2017 17    .50216955            0
1111 2004 34    .10313594            0
1111 2005 34    .23477797            0
1111 2006 34     .1116037            0
1111 2007 34    .16230033            0
1117 2004 36      .081571            0
1117 2005 36    .10504886            0
1117 2006 36    .05231388            0
1117 2007 36    .14885193            0
1117 2008 36   .033519555            0
1117 2009 36   .011428572            0
1117 2010 36   .018118467            0
1117 2011 36    .01365462            0
1117 2012 36     .0217938            0
1117 2013 36    .12770137            0
1117 2014 36     .1799832            0
1117 2015 36     .1891253            0
1117 2016 36      .237582            0
1117 2017 36    .05107742            0
1161 2004 36    .09675121            0
1161 2005 36   .070256375            0
1161 2006 36     .1583937            0
1161 2007 36    .09398411            0
1161 2008 36    .02224554            0
1161 2009 36    .02707276            0
1161 2010 36    .03929024            0
1161 2011 36    .09911243            0
1161 2012 36    .05454545            0
1161 2013 36    .06812652            0
1161 2014 36   .068249255            0
end
label values industry ffi
label def ffi 12 "Medical Equipment", modify
label def ffi 13 "Pharmaceutical Products", modify
label def ffi 17 "Construction Materials", modify
label def ffi 21 "Machinery", modify
label def ffi 34 "Business Services", modify
label def ffi 36 "Electronic Equipment", modify
label def ffi 37 "Measuring and Control Equipment", modify
label def ffi 41 "Wholesale", modify