Dear Statalist,
I have a data set with two variables 'id' and 'group'. I want to assign observations with a same 'group id' if their 'group' variables are overlapping.
In the example data below, ideally, I want all four observations receive a same 'group id'. I tried splitting out the 'group' variables and then re-arranged the data but could not manage to get what I want.
Any suggestions are appreciated.
Thanks!
I have a data set with two variables 'id' and 'group'. I want to assign observations with a same 'group id' if their 'group' variables are overlapping.
In the example data below, ideally, I want all four observations receive a same 'group id'. I tried splitting out the 'group' variables and then re-arranged the data but could not manage to get what I want.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str16 id str487 group "A" "A,B,C" "B" "A,C,D" "C" "B,C,D" "D" "C,D" end
Thanks!
Comment