title: SAS sort by original order
body: <p>Say you have three separate data sets consisting of the same number of observations. Each observation has an ID letter, A-Z, followed by some numerical observation. For example:</p>
  
  <p>Data set 1:</p>
  
  <pre><code>B   3   8   1   9   4
  C   4   1   9   3   1
  A   4   4   5   4   9
  </code></pre>
  
  <p>Data set 2:</p>
  
  <pre><code>C   3   1   9   4   0
  A   4   1   2   0   0
  B   0   3   3   1   8
  </code></pre>
  
  <p>I want to merge the data sets BY that first variable. The problem is, the first variable is NOT already sorted in alphabetical form, and I do not want to sort it in alphabetical form. I want to merge the data but keep the original order. For example, I would get:</p>
  
  <p>Merged data:</p>
  
  <pre><code>B   3   8   1   9   4
  B   0   3   3   1   8
  C   4   1   9   3   1
  C   3   1   9   4   0
  A   4   4   5   4   9
  A   4   1   2   0   0
  </code></pre>
  
  <p>Is there any way to do this?</p>