Hello
I have a bunch of unit dummys (u1-u350) and year variable for the years 2000-2020, and I want to create a variable that takes the values of 2000-2020 for the first unit (u1) and 0 for the rest, a variable that takes the values of 2000-2020 for the second unit (u2) and 0 for the rest and so on. Do you guys know an efficient way to go about this? I have 350 units so
is a bit inconvenient
I have a bunch of unit dummys (u1-u350) and year variable for the years 2000-2020, and I want to create a variable that takes the values of 2000-2020 for the first unit (u1) and 0 for the rest, a variable that takes the values of 2000-2020 for the second unit (u2) and 0 for the rest and so on. Do you guys know an efficient way to go about this? I have 350 units so
Code:
gen u1year = u1*year gen u2year = u2*year gen u3year = u3*year gen u4year = u4*year gen u5year = u5*year gen u6year = u6*year ...
Comment