0

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: Creating Co-Occurrence Matrix.

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.

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:

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.

The output needed is something like this:

   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

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.

Thank you.

Community
  • 1
  • 1
jacatra
  • 497
  • 1
  • 6
  • 8
  • The MBA macro still exists so you can use that. – Reeza Apr 23 '17 at 22:57
  • I think you need to post a better example, one where the data aligns with the output. I don't understand how you're determining the entries of 1 vs 3. If you transpose the initial data set then you can use the solution I have here: https://gist.github.com/statgeek/a5184a4e1678d81e2643 Otherwise you may want to investigate the Enterprise Miner option. – Reeza Apr 23 '17 at 22:59
  • @Reeza, Thank you for the tip -- I can transpose the data and try your solution. Much appreciated. – jacatra Apr 23 '17 at 23:03
  • https://www.mwsug.org/proceedings/2013/AA/MWSUG-2013-AA07.pdf – Reeza Apr 24 '17 at 01:49

0 Answers0