Dear Statalist Members,
Consider a city-time panel. There are 81 cities, each has a unique identifier called variable "plate" from 1 to 81. The years span from 2003 to 2018. Each city is observed once from 2003 to 2018.
I'd like to create a variable, let's say "constant". I want this "constant" variable to take 10 (because another variable, let's call it "X" is 10 in year 2017) for city A (the city is A has unique identifier called "plate" which is 1) across all years from 2003 to 2018. I would like "constant" variable to take 10 across all years from 2003 to 2018 for city A.
For example, if this X variable is 15 in 2017 for city B (which has a unique identifier plate==2), I want this "constant" variable to take 15 from 2003 to 2018 for city B.
I have used forvalues command but I cannot make it.
I would be reallt appreciated if you can help me.
Best,
C
Consider a city-time panel. There are 81 cities, each has a unique identifier called variable "plate" from 1 to 81. The years span from 2003 to 2018. Each city is observed once from 2003 to 2018.
I'd like to create a variable, let's say "constant". I want this "constant" variable to take 10 (because another variable, let's call it "X" is 10 in year 2017) for city A (the city is A has unique identifier called "plate" which is 1) across all years from 2003 to 2018. I would like "constant" variable to take 10 across all years from 2003 to 2018 for city A.
For example, if this X variable is 15 in 2017 for city B (which has a unique identifier plate==2), I want this "constant" variable to take 15 from 2003 to 2018 for city B.
I have used forvalues command but I cannot make it.
I would be reallt appreciated if you can help me.
Best,
C
Comment