Hello,

I want to include some fixed effects in my model that I believe are difficult to include so any advice on how exactly this can be done would be very helpful. My data is at the Firm x Year level, except the Firms have different exposures to different countries in every year, and I want to include Country x Year fixed effects (as well as Firm fixed effects). The predictor variable of interest is a linear combination (based on the shares of each firm) of a Country x Time variable, so that's why Country x Time fixed effects are important.

For example, my data looks like this:
Firm Year Firm Yt Firm Xt
1 1 8 6.5
1 2 3 2.8
2 1 6 4.4
2 2 15 11.1
3 1 7 5.75
3 2 13 9.6
where I know the following (in addition to the shares of each firm, which are used to calculate Xt):
- Firm 1 is in countries 1,2,3 in Year 1; and in countries 1,2 in year 2
- Firm 2 is in countries 1 & 3 in Year 1; and in countries 2 & 3 in year 2
- Firm 3 is in all 3 countries in both time periods.

What I would like to do is regress Yt on Xt, Firm fixed effects, and Country x Year fixed effects. I also want to cluster standard errors at the Firm level. To complicate things, my dataset is actually very large (thousands of firms, thousands of geographies, and close to 100 time periods) so whatever I do has to be doable with large datasets.

I did some research and potentially found a way to do it by expanding the data to be at the Firm x Country x Year level, but this would be pretty difficult to do with my original dataset (would increase its size dramatically) and I am not sure if "repeating" the observations within my data would affect my estimates, because it would make it look like I have more observations than I actually do. To illustrate, in the above example, this data would be expanded to something like this:
Firm Country Year Firm Yt Firm xt
1 1 1 8 6.5
1 2 1 8 6.5
1 3 1 8 6.5
1 1 2 3 2.8
1 2 2 3 2.8
2 1 1 6 4.4
2 3 1 6 4.4
2 2 2 15 11.1
2 3 2 15 11.1
3 1 1 7 5.75
3 2 1 7 5.75
3 3 1 7 5.75
3 1 2 13 9.6
3 2 2 13 9.6
3 3 2 13 9.6
So I'm just listing the countries a firm is in and repeating the firm's Yt and Xt. Then I can run this command:

Code:
reghdfe y x, absorb(firm country#time) vce(cluster firm)
Again, I am not sure this solution is ok, especially because I'm manually repeating each firm's observations several times. Any help would be appreciated!