Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: Transform source table to edgelist (or nodelist)

From   Nick Cox <>
To   "''" <>
Subject   st: RE: RE: Transform source table to edgelist (or nodelist)
Date   Mon, 20 Feb 2012 12:25:00 +0000

Sorry, no; that's a different problem. 


-----Original Message-----
From: [] On Behalf Of Nick Cox
Sent: 20 February 2012 10:54
To: ''
Subject: st: RE: Transform source table to edgelist (or nodelist)

This looks like an FAQ

although I suspect there is a less clumsy way to approach it. 


Steve Sauerwald

I have a source table that contains manager/firm information. A
manager can work for M companies and a company can have N managers.
For instance, the following table shows 2 firms (FID 1 and 2) and four
managers (MID A, B, C, and D).

1       A
1       B
1       C
2       A
2       B
2       D

Now, I'd like to create the interlocking relationships between managers. If
two managers work together in the same firm (or in more than one
firm), this would indicate a "1." If not, a "0." The end result should
be an adjacency matrix but I'd be happy to get to an edgelist first
such as the following:

A       B        1
A       C        1
A       D        1
B       C        1
B       D        1
C       D        0

Based on the information in the source table, manager C and manager D
are not connected in either firm 1 or 2, hence the 0. My actual source
table contains quite a few records so it would be great to automate
this process. Does anyone have an idea of how to implement this in

Alternatively, the UCLA Stata website
( shows some
code to transform a nodelist into an adjacency matrix (If someone
knows a way to transform my source table into a nodelist, that'd be
also a great help).

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index