Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72776

How to transform the pairwise data into matrix?

$
0
0
Dear all,

I now have the pairwise data in hand. I wonder how can I transform it into a matrix?

For instance, please see below the sample data. Now I have 8 pairs of inventors in the dta. In total, that involves 11 unique inventors.

And what I want to achieve is to transform it into a 11*11 symmetric matrix, in which 1 represents there is a link between two inventors (i.e., shown by the pairwise relationship), and 0 represents no such link exists.

Thanks in advance!

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(inv1 inv2)
1251  381737
1251  574597
1668 1104599
1894   72279
1894  104575
1894  135775
1894  135827
1894  248348
end







Viewing all articles
Browse latest Browse all 72776

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>