Dear All,

I want to conduct a two-stage least squares regression using the ivreg2 command. I have quarterly data (26 quarters ) at the US state level (50 states). I want to include in my regression state specific quadratic time trends. So ideally I want to run:

ivreg y x1 x2 x3 i.qtr i.state i.state#(c.qtr c.qtrsq) (x4= z), first robust

However, I get an error:
factor variables not allowed

What is the easiest way to convert the
i.state#(c.qtr c.qtrsq) into dummies that I can include? Sorry if this is a very basic question...but I couldn't find an answer on the list and can't think of a clean solution...

Will greatly appreciate any help.
Sincerely,
Sumedha.