Dear Statalists,
I would like to create non-directional pair ID for 2 variables var1 var2 :
With non-directional I mean ID for AB is the same as ID for BA. If I use
I will get different IDs for AB an BA, which is not what I want.
Could someone please help me with this?
Thank you very much!
A
I would like to create non-directional pair ID for 2 variables var1 var2 :
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str1(var1 var2) "A" "A" "A" "B" "A" "C" "B" "A" "B" "B" "B" "C" "C" "A" "C" "B" "C" "C" end
Code:
egen id = group(var1 var2)
Could someone please help me with this?
Thank you very much!
A
Comment