Hello,
I would like to run a diff-in-diff model with state fixed effects (FE), year FE and states specific trends with reghdfe.
the model I would like to estimate is the following: where y is my dependent variable and treat is a dummy indicating whether the state was treated.

Code:
y_{i,t}=\beta treat_{i,t}+\sum \gamma_k state_{k,s}+\sum \delta_j year_{j,y}+\sum\theta_k(state\times t)+\varepsilon
I am not sure how to specify the model correctly using reghdfe. I have data in long format and I have tried the following:

Code:
cap egen stateFE=group(states) // create my state fe
cap egen yearFE=group(year)// create my year fe
reghdfe y treat, a(i.stateFE##c.year) cluster(prod)
//or
reghdfe y treat, a(yearFE i.stateFE##c.year) cluster(prod)
My sense is that the correct specification for the command is the second, but I wanted to be sure I was taking the correct approach given that estimates are sensibly different

Thanks a lot for your help


Best regards