Dear Statalists,

Can you please help me with the models for panel data with 200 firms of 20 industries over 10 years?

xtreg y x1 controls i.year i.industry

x1 is endogenous, so I should regress x1 on x2, controls and year&industry dummies
But x2 is also endogenous, x2 = z i.year i.industry (z is the instrument for x2)

Can anyone help me how to write 3sls using reg3 or any commands for 3sls, please? I have tried to find if reg3 is suitable for panel data, the answer is unclear.

I will really appreciate your help.

Thank you so much.