I have a question that I have been struggling with in the past few days. I have read the documentation, and although I see parts that can help me accomplish this, I cannot seem to put these together and create a command that does what I want. I will try to explain it the best that I can, and I hope that someone can share their knowledge.
I have the following database:
Code:
input str12 Firm int Year double WorkerID str78 Experience "JE00BD3QJR55" 2014 31 "Management" "JE00BD3QJR55" 2014 23 "Employee" "JE00BD3QJR55" 2014 34 "Warehouse" "JE00BD3QJR55" 2014 54 "Executive" "JE00BD3QJR55" 2014 12 "Management" "JE00BD3QJR55" 2015 31 "Management" "JE00BD3QJR55" 2015 23 "Employee" "JE00BD3QJR55" 2015 34 "Warehouse" "JE00BD3QJR55" 2015 54 "Employee" "JE00BD3QJR55" 2015 12 "Management" "JE00BD3QJR55" 2015 64 "Executive" "KF25CI1FJR491" 2016 31 "Management" "JE00BD3QJR55" 2016 23 "Employee" "JE00BD3QJR55" 2016 34 "Warehouse" "JE00BD3QJR55" 2016 54 "Executive" "JE00BD3QJR55" 2016 12 "Management" end
I then, want to sum the variables on firm-year level. So, in the case of JE00BD3QJR55-2014, a 0 would be assigned. In the case of JE00BD3QJR55-2015, however, a 3 would be assigned (because WorkerIDs 31, 54, and 12 had experience as Management and/or Executive in the year 2014). In the case of KF25CI1FJR491-2016, which is a different firm, a 1 would be assigned, since WorkerID 31 has been found previously in the data in a different firm with management experience.
I did my best to explain in detail what I want. I hope someone can share their knowledge on how to do this.
Thank you for your time reading this.
Best regards,
Ferry
0 Response to Finding and encoding previous experience
Post a Comment