In reply to Bob McConnaughey.

You are welcome to implement your idea and post it. If there are k variables, you need to correctly fill an array that has k(k-1)/2 elements, since that is the number of pairwise combinations. You also need to create a label or name so that it is clear which element contains the counts for the combination of variable i and variable j.