Note that there are some explanatory texts on larger screens.

plurals
  1. POEquivalent Groups
    text
    copied!<p>In Stata I have this data of people who have worked together on a project. Each row is a project and there are columns person_1 to person_20, and if a name is in that column it means that person worked on that project in the row. A group can be 1 person, 2 people, ..., 20 people. I have a binary variable (yes = 1) for each possibility: Group of 1 (G1), G2, ..., G11. Then I used this code to make the groupings (using the 4 person group as an example):</p> <pre><code>project_group = person_1 + "/" + person_2 + "/" + person_3 + "/" + person_4 if G4 == 1 This yields: Tom/Joe/Mike/Sally </code></pre> <p>I have three questions: 1) Is there a more efficient way to make the groupings. For example, code that just looks across a project (a row), counts how many people are there (how many fields are not empty) and then creates a unique group name that is each person's name separated by "/". I am fine with the code I created but my dataset will change in size and more efficient code is probably best</p> <p>2) How can I treat, from my example, Joe/Tom/Mike/Sally or Sally/Joe/Mike/Time as the same group. I would prefer that all of the groups, no matter the size, listed each person by alphabetical order. From my example, the list would be Joe/Mike/Sally/Tom no matter the actual permutation. </p> <p>3) How do I make a group unique based on the first person (if they are a project leader they are the first name listed). So Joe/Tom/Mike and Joe/Mike/Tom are the same Group but Tom/Joe/Mike and Mike/Tom/Joe are not.</p> <p>Thanks for the help and suggestions</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload