I'm working through a database with several repeated IDs entries and unique information per row as such
ID | country |
---|---|
A1 | AT |
A1 | BE |
A2 | CZ |
A3 | US |
A3 | UK |
A4 | NZ |
The same ID and different country implies there was collaboration between two different entities in this project.
How can I treat the dataset to tabulate collaborations? I would like to obtain
AT BE CZ NZ US UK
AT 1
BE 1
CZ
NZ 1 1
US 1 1
UK 1 1
Preferably I could have the option to remove duplicates to get
AT BE CZ NZ US UK
AT 1
BE
CZ
NZ 1 1
US
UK
and somehow get a variable to produce 'summarize'.
Thank you in advance (I can't get access to Stata Forum due to a firewall)
I tried creating variables that identify multi-country IDs and another that reads the country when it is the second or third linked to the same ID
ID | country | var 1 | var 2 |
---|---|---|---|
A1 | AT | 1 | |
A1 | BE | 2 | |
A2 | CZ | ||
A3 | US | 1 | |
A3 | UK | 2 | |
A4 | NZ | 3 |