title: Creating co-occurrence matrix in SAS
body: <p>All, thanks to the amazing help and camaraderie at Stack Exchange, I can now build and do further analysis using the co-occurrence matrix R code that was discussed in my original thread: <a href="https://stackoverflow.com/questions/13281303/creating-co-occurrence-matrix">Creating Co-Occurrence Matrix</a>. </p>
  
  <p>I am now dealing with a massive data set that could only be processed on a server, and I am using SAS Studio to analyse it and thus, I will have to do the co-occurrence analysis using SAS. I would really appreciate any help from SAS experts out there, as my SAS programming techniques are limited. I am trying to do it in the SAS Studio environment. </p>
  
  <p>So, essentially - I have a massive SAS .sav file of households and items, and I want to see a matrix of the number of households where items appear together. Taking the same example from my earlier thread, essentially I have a table containing the following:</p>
  
  <pre><code>HHID Items Quant
  HH1 A 3
  HH1 B 1
  HH1 C 1
  HH2 E 3
  HH2 B 1
  HH3 B 1
  HH3 C 4
  HH4 D 1
  HH4 E 1
  HH4 A 1
  HH5 F 5
  HH5 B 3
  HH5 C 2
  HH5 D 1, etc.
  </code></pre>
  
  <p>The output needed is something like this:</p>
  
  <pre><code>   A B C D E F
  A  0 1 1 0 1 1
  B  1 0 3 1 1 0
  C  1 3 0 1 0 0
  D  1 1 1 0 1 1
  E  1 1 0 1 0 0
  F  0 1 1 1 0 0
  </code></pre>
  
  <p>I see that there is a macro out there that is done to do market basket analysis already, and although the output is not in this format, I can work with it as well. It's just too bad that the website doesn't exist anymore, so any help is much appreciated.</p>
  
  <p>Thank you.</p>