Dear Statalisters,

I have a dataset which matches romantic partners in the following way:
Code:
clear
set obs 6
input id partner  
26    83
27    72
28    53
83    26
72    27
53    28
.
where 'id' is individual i's identifier and 'partner' contains the identifier of the individual j with which i is matched.

I need to be able to create unique couple identifiers. The following method:
Code:
egen coupid = group(id partner)
does not work as it creates different identifier for "A" matched with "B" and "B" matched with "A".

Does anyone know how to solve this problem?

Fabio