Hello,
I am currently working with panel data where I have for every District in the years 2002, 2007, 2012 and 2017 observations on the total workforce in each district and the total workforce in agriculture (taz).
Now, I want to create a new variable, that gives the ratio of taz/total_workforce_i. However, I want for the years 2002 and 2007 to derive the ratio based on the 2002 total_workforce_i (=276) and with a taz for the respective years and to use the total_workforce of 2012 for the years 2012 and 2017 with the individual taz's for the respective years.
I already tried several options but none resulted in the desired output. Do you have any suggestions on how to approach it?
Thank you very much in advance!
I am currently working with panel data where I have for every District in the years 2002, 2007, 2012 and 2017 observations on the total workforce in each district and the total workforce in agriculture (taz).
Now, I want to create a new variable, that gives the ratio of taz/total_workforce_i. However, I want for the years 2002 and 2007 to derive the ratio based on the 2002 total_workforce_i (=276) and with a taz for the respective years and to use the total_workforce of 2012 for the years 2012 and 2017 with the individual taz's for the respective years.
I already tried several options but none resulted in the desired output. Do you have any suggestions on how to approach it?
Thank you very much in advance!
Code:
clear input str36 District float Year double(total_workforce_i taz) "01001" 2002 276.06683349609375 31.349594116210938 "01001" 2007 380.1287536621094 43.105690002441406 "01001" 2012 340 28 "01001" 2017 370 20 "01002" 2002 40.023956298828125 0 "01002" 2007 107.99324798583984 7.837398529052734 "01002" 2012 104 0 "01002" 2017 105 0 "01004" 2002 4549.923034667969 27.43089485168457 "01004" 2007 5502.69140625 27.089689254760742 "01004" 2012 5877.88134765625 13.972138404846191 "01004" 2017 5669.05859375 15.497458457946777 end
Comment