Hi everyone,

I have a large firm level panel with 1 million units over 20 years. I want to run a diff-in-diff with the recent Chaisemartin and Haultfeuille estimator which does not allow the use of factor variables (their command did_multiplegt does not). How can I create such a large number of fixed effects at the firm level across time and separately across counties? I can to run a loop but it's so computationally demanding that I cannot run it even on the server. The code for county and industry fixed effects is below (less number of fixed effects). The problem is that the number of firms is too large and when I modify the same code for firms, it's doesn't run (not enough memory).

Thank you!

Code:
    forval q = 1/50 {    
        * For each county
        forval c = 1/279 {
            gen county_year_`q'_`c' = year_dummy`q'    * county_dummy`c'
        }
        * For each industry
        forval i = 1/50 {
            gen industry_year_`q'_`i' = year_dummy`q' * industry_dummy`i'
        }    
    }