Dear Stata users,
I have a dataset with Project identifiers (id_project), and Person identifiers (id_person). I also have another variable (name_surname), which is the name and surname associated to each id_person. Each observation in the dataset represents a link between a project and a person.
Departing from this dataset, what I would like is to create a new dataset, where each observation corresponds different individual (id_person). Then, I want to create new variables for each individual to reflect co-participation in projects with others. Thus, for each observation, I want to make different columns with the codes and names of all other individuals with whom the focal individual has shared participation in any project. Note that persons can be attached to more than one different project, and that the number of participants in each project can vary.
This is what my dataset looks like (I've replaced the original names with XXX):
So, I'd like to create something like this, for each individual:

I've been trying to solve it with reshape wide, but I have not managed to solve it.
Any help would be greatly appreciated. Many thanks !!
Best,
Oscar
I have a dataset with Project identifiers (id_project), and Person identifiers (id_person). I also have another variable (name_surname), which is the name and surname associated to each id_person. Each observation in the dataset represents a link between a project and a person.
Departing from this dataset, what I would like is to create a new dataset, where each observation corresponds different individual (id_person). Then, I want to create new variables for each individual to reflect co-participation in projects with others. Thus, for each observation, I want to make different columns with the codes and names of all other individuals with whom the focal individual has shared participation in any project. Note that persons can be attached to more than one different project, and that the number of participants in each project can vary.
This is what my dataset looks like (I've replaced the original names with XXX):
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10 id_project float(id_person id_participant) str39 name_surname "2017_01" 77 109 "XXX" "2017_01" 233 383 "XXX" "2017_01" 419 682 "XXX" "2017_01" 464 770 "XXX" "2017_01" 494 831 "XXX" "2017_01" 539 915 "XXX" "2017_02" 122 187 "XXX" "2017_02" 131 208 "XXX" "2017_02" 257 426 "XXX" "2017_02" 274 459 "XXX" "2017_02" 319 524 "XXX" "2017_02" 332 540 "XXX" "2017_03" 95 146 "XXX" "2017_03" 195 318 "XXX" "2017_03" 208 339 "XXX" "2017_03" 246 410 "XXX" "2017_03" 334 546 "XXX" "2017_03" 388 641 "XXX" "2017_03" 484 810 "XXX" "2017_03" 509 864 "XXX" end
I've been trying to solve it with reshape wide, but I have not managed to solve it.
Any help would be greatly appreciated. Many thanks !!
Best,
Oscar
Comment