title: How to sort variables horizontally with arrays and use of call sortc
body: <p>A user on sasprofessionals.net had a problem of not being able to group his dataset by several variables where variable values are interchangeable within the observation because they carried the same meaning. </p>
  
  <p>In the example dataset, observation 2,3 and 7 are the same because each of them have A14, A14 and A10 as values for Stat1 to Stat3, and it is only the order is different. These should be grouped by Count. Observation 5 and 6 form another group that should be summed up by count. </p>
  
  <p>Example dataset: </p>
  
  <pre><code>Obs Stat1 Stat2 Stat3 Count
  1   A14   A14   A14   53090
  2   A14   A14   A10   6744
  3   A14   A10   A14   5916
  4   A01   A01   A01   4222
  5   A10   A10   A10   3085
  6   A10   A10   A10   2731
  7   A10   A14   A14   2399
  </code></pre>
  
  <p>Desirable output: </p>
  
  <pre><code>Obs Stat1 Stat2 Stat3 Count
  1   A14   A14   A14   53090
  4   A01   A01   A01   4222
  6   A10   A10   A10   5816
  7   A10   A14   A14   15059
  </code></pre>
  
  <p>The actual dataset is larger and more complex. I am not aware if the user tried any methods to solve the problem. </p>
  
  <p><em>This question was originally posted on sasprofessionals.net and it was copied to StackOverflow for the benefit of the community. It was changed to meet the StackOverflow Q&amp;A standards.</em></p>