Dear all,
Suppose I have the following dataset
Code:
clear
input var1 var2
1 1
1 2
1 3
1 4
2 1
2 2
2 3
2 4
3 1
3 2
3 3
3 4
4 1
4 2
4 3
4 4
end
I'd like to create a list of IDs based on var1 and var2. In particular, I'd like to get the same ID when the observations in var1 and var2 are swapped. For example, var1=3 and var2=4 should have the same ID as where var1=4 and var2=3.
I have tried
Code:
egen id = group(var1 var2)
but it doesn't not give me exactly what I'm looking for.
Could anyone please help me with this?
Thank you very much for your help,
Vinh
0 Response to Generating IDs
Post a Comment