Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>1) Is there a more efficient way to make the groupings.</p> </blockquote> <p>I'm not sure I understand what's wrong with your current arrangement, which seems clean and easily readable.</p> <blockquote> <p>2) How can I treat, from my example, Joe/Tom/Mike/Sally or Sally/Joe/Mike/Time as the same group.</p> </blockquote> <p>I'll assume you meant Tom and not Time in your last string.</p> <pre><code>egen team_size = anycount(person_1-person_20), v(1) gen team_leader = . if team_size &gt; 0 replace team_leader = person_1 gen team_structure = 0 replace team_structure = team_structure + regexm(project_group,"Joe") replace team_structure = team_structure + regexm(project_group,"Tom")*10 replace team_structure = team_structure + regexm(project_group,"Mike")*100 replace team_structure = team_structure + regexm(project_group,"Sally")*1000 </code></pre> <p>The <code>team_structure</code> is a $k$-length binary that codes for the team membership of $k$ members irrespective of the order in which they might show in the <code>project_group</code> string. This is code-expensive if you have a lot of members, but pretty easy to create.</p> <blockquote> <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> </blockquote> <p>Trivial suggestion: add a factor to each possible member (<code>encode</code>), and assign it to the decimal of the <code>team_structure</code> variable created above. Example: 1011.1 is the group Joe/Mike/Sally led by Joe, 1011.4 is the same group led by Sally, and so on.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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