Dear all,
I am trying to generate variable y that interacts with variable x and year indicator in panel data, where x = housingsupply in year 1 that varies across counties, and I want to generate a variable, y, that is based on housingsupply in year1 and evolves over time according to the year-fixed effect after year 1. So y should vary across year and county. The idea is similar to a Bartik-style instrument, where housingsupply in year 1 serves as a historic share.
So, I did
sort wave
gen y = x * i.year
I got the error message,
i: operator invalid
r(198);
It appears that Stata does not allow for generation of a variable that interacts between another variable and i.year?
Thanks,
Kangoh
I am trying to generate variable y that interacts with variable x and year indicator in panel data, where x = housingsupply in year 1 that varies across counties, and I want to generate a variable, y, that is based on housingsupply in year1 and evolves over time according to the year-fixed effect after year 1. So y should vary across year and county. The idea is similar to a Bartik-style instrument, where housingsupply in year 1 serves as a historic share.
So, I did
sort wave
gen y = x * i.year
I got the error message,
i: operator invalid
r(198);
It appears that Stata does not allow for generation of a variable that interacts between another variable and i.year?
Thanks,
Kangoh

Comment