hello everyone,
I'm trying to use "pairdata" for the first time and found a question: my individualID variable is not unique
the example dataset looks like:
input int (year city ind X Y)
1 1 1 0.3 321
1 1 2 0.7 452
1 2 3 0.8 879
1 2 4 0.6 897
1 3 5 0.9 356
1 3 6 0.5 698
end
I hope the dataset would look like this:
input int (year city ind X Y) str5 pair
1 1 1 0.3 321 "(1,2)"
1 1 2 0.7 452 "(1,2)"
1 2 3 0.8 879 "(1,2)"
1 2 4 0.6 897 "(1,2)"
1 1 1 0.3 321 "(1,3)"
1 1 2 0.7 452 "(1,3)"
1 3 5 0.9 356 "(1,3)"
1 3 6 0.5 698 "(1,3)"
1 2 3 0.8 879 "(2,3)"
1 2 4 0.6 897 "(2,3)"
1 3 5 0.9 356 "(2,3)"
1 3 6 0.5 698 "(2,3)"
end
(Real dataset has many years, the example just listed one)
I try to use "pairdata X Y, ind(city) fam(year)", it doesn't work because the variable "city" is duplicate.
Any help would be immensely appreciated! Thank you!
I'm trying to use "pairdata" for the first time and found a question: my individualID variable is not unique
the example dataset looks like:
input int (year city ind X Y)
1 1 1 0.3 321
1 1 2 0.7 452
1 2 3 0.8 879
1 2 4 0.6 897
1 3 5 0.9 356
1 3 6 0.5 698
end
I hope the dataset would look like this:
input int (year city ind X Y) str5 pair
1 1 1 0.3 321 "(1,2)"
1 1 2 0.7 452 "(1,2)"
1 2 3 0.8 879 "(1,2)"
1 2 4 0.6 897 "(1,2)"
1 1 1 0.3 321 "(1,3)"
1 1 2 0.7 452 "(1,3)"
1 3 5 0.9 356 "(1,3)"
1 3 6 0.5 698 "(1,3)"
1 2 3 0.8 879 "(2,3)"
1 2 4 0.6 897 "(2,3)"
1 3 5 0.9 356 "(2,3)"
1 3 6 0.5 698 "(2,3)"
end
(Real dataset has many years, the example just listed one)
I try to use "pairdata X Y, ind(city) fam(year)", it doesn't work because the variable "city" is duplicate.
Any help would be immensely appreciated! Thank you!
Comment