I am trying to accomplish a (I think) rather simple task but I just cannot seem to get the desired result. I will try to explain it as clear as possible, show a part of my data, and describe what my desired result is. I hope that you can share your expertise with me on how to accomplish it.
Below, I have data of board directors and in what year they sat on which committee.
Code:
input long DirectorID str38 CommitteeName int Year 1111 "Acquisitions" 2018 2222 "Audit" 2018 3333 "Acquisitions" 2018 5555 "Acquisitions" 2018 1111 "Acquisitions" 2019 2222 "Acquisitions" 2019 3333 "Acquisitions" 2019 4444 "Acquisitions" 2019 5555 "Acquisitions" 2019 1111 "Acquisitions" 2020 2222 "Acquisitions" 2020 3333 "Acquisitions" 2020 4444 "Acquisitions" 2020 6666 "Acquisitions" 2020
In the first sample year (2018), of course, all then should be assigned a 0 since I do not have data before this time. However, in the data example above and in the year 2019, Directors 1111, 3333, and 5555 should be assigned a '1', since they have previously been in a similar position. Note that Director 2222, although previously found in the data, should not be assigned a 1, since he/she did not sit in the same committee. Also, Director 4444 should not be assigned a '1', since there was no data on him/her in the year 2018. To try and make it clearer, in the year 2020 directors 1111, 2222, 3333, and 4444 should be assigned a '1', since they all sat on the same committee previously. Director 6666 should be assigned a 0, since we did not yet see this director in the data and similar committee.
Does anybody have an idea how to do this? If it is not clear, please let me know. I will then try to clarify this as much as possible.
Thank you for your time and efforts.
Best regards,
Marc
0 Response to Assigning a dummy based on previous role
Post a Comment