Dear Statalists,
my dataset is about directors and which companies they work for and looks like this:
The variable "new_app" is 1 whenever the term of a director began between 1996 and 2014, otherwise it is 0.
Now I would like to create "company pairs". That means whenever a director was appointed by a company in the above mentioned time period (new_app = 1), I want to know all other companies he worked for in that year. For example, if we take Director 2, when he was appointed by company 86594 in 1999, he also worked for companies 44601 and 15720, as his terms at those companies ended in 2005/2002. So I need to identify the combinations or pairs of companies. Ideally, the output (only director 2) would look like this:
Can anyone help me out with this? I´m willing to thank with a small reward!
my dataset is about directors and which companies they work for and looks like this:
Company_ID | Director_ID | Term Begin | Term End | new_app |
40416 | 1 | 1977 | 1999 | 0 |
15456 | 1 | 1983 | 2013 | 0 |
76085 | 1 | 1994 | 2005 | 0 |
44601 | 2 | 1975 | 2005 | 0 |
15720 | 2 | 1988 | 2002 | 0 |
86594 | 2 | 1999 | 2005 | 1 |
44601 | 3 | 1990 | 2006 | 0 |
78172 | 3 | 2000 | 2005 | 1 |
87657 | 3 | 2000 | 2009 | 1 |
44601 | 4 | 1988 | 2013 | 0 |
44601 | 5 | 1985 | 1999 | 0 |
40707 | 5 | 1991 | 2003 | 0 |
57568 | 6 | 1995 | 2007 | 0 |
80316 | 6 | 2002 | 2009 | 1 |
52840 | 7 | 1987 | 2009 | 0 |
24221 | 7 | 1999 | 2005 | 1 |
24221 | 8 | 1999 | 2009 | 1 |
52840 | 9 | 1970 | 2005 | 0 |
62148 | 9 | 1998 | 2002 | 1 |
59459 | 9 | 1998 | 2003 | 1 |
24221 | 9 | 1999 | 2004 | 1 |
90601 | 9 | 2000 | 2012 | 1 |
10137 | 9 | 2003 | 2011 | 1 |
The variable "new_app" is 1 whenever the term of a director began between 1996 and 2014, otherwise it is 0.
Now I would like to create "company pairs". That means whenever a director was appointed by a company in the above mentioned time period (new_app = 1), I want to know all other companies he worked for in that year. For example, if we take Director 2, when he was appointed by company 86594 in 1999, he also worked for companies 44601 and 15720, as his terms at those companies ended in 2005/2002. So I need to identify the combinations or pairs of companies. Ideally, the output (only director 2) would look like this:
Company_1 | Company_2 | Director_ID | Year |
86594 | 44601 | 2 | 1999 |
86594 | 15720 | 2 | 1999 |
Can anyone help me out with this? I´m willing to thank with a small reward!

Comment