title: Creating a single record from multiple records in SAS
body: <p>I have a SAS Data set called <code>coaches_assistants</code> with the following structure. There are always only two records per <code>TeamID</code>.</p>
  
  <pre><code>TeamID     Team_City    CoachCode
  123        Durham       Head_242
  123        Durham       Assistant_876
  124        London       Head_876
  124        London       Assistant_922
  125        Bath         Head_667
  125        Bath         Assistant_786
  126        Dover        Head_544
  126        Dover        Assistant_978
  ...        ...          ....
  </code></pre>
  
  <p>What I'd like to do with this is to create a data set with an extra field called <code>AssistantCode</code> and make it look like:</p>
  
  <pre><code>TeamID     Team_City    HeadCode   AssistantCode
  123        Durham       242        876
  124        London       876        922
  125        Bath         667        786
  126        Dover        544        978
  ...        ...          ...        ...
  </code></pre>
  
  <p>If possible, I'd like to do this in a single DATA step (though I recognize that I might need a PROC SORT step first). I know how to do it in python or ruby or any traditional scripting languages, but I don't know how to do it in SAS.</p>
  
  <p>What's the best way to do this?</p>