Clustering with sets as values
It would appear that you have a data processing task. You could use two columns 'A Occurrence' and 'B Occurrence'. If that value occurs for the record that index would contain a 1. If that value does not occur for that record the index would contain a 0.

Example:

X       | A Occurrence | B Occurrence
A       | 1            | 0
A and B | 1            | 1