I am using Stata 15.0
I am trying to construct the variable Prior Tie Density (the number of formed ties between VCs in a group / total number of ties they could have formed). For me, this is fairly complicated and I hope somebody can help me.

A tie was formed if the VCs invested at the same time in the same company.
I have already made a variable "SyndicateNumber", that groups transactions in the same company on the same date

Code:
egen SyndicateNumber = group (CompanyName InvestmentDate)
Let's take the example of the following Syndicate (group A)

Code:
0-In Design Automation, Inc."                   "Canaan Partners"                    14146  2
"0-In Design Automation, Inc."                              "Sigma Partners"                     14146  2
"0-In Design Automation, Inc."                              "CMEA Development Company LLC"       14146  2
I need to calculate if, in the five years prior to the focal InvestmentDate (in the example 14146)
  • "Canaan Partners" has made an investment together with "Sigma Partners"
  • "Canaan Partners" has made an investment together with "CMEA Development Company LLC"
  • Sigma Partners has made an investment together with "CMEA Development Company LLC"
Again, as the variable "SyndicateNumber" indicates that a transaction was made on the same day.

I thought that the following code would work

Canaan Partners together with Sigma Partners (the _n1 indicates, 'has invested with the VC one observation below this observation)
Code:
 gen Prior_Tie_n1 = 0
replace Prior_Tie_n1 =1 if SyndicateNumber FirmName[`i'] = SyndicateNumber FirmName[`i'+1] & inrange(InvestmentDate[`i'],InvestmentDate-1825, InvestmentDate-0)
Canaan Partners together with CMEA Development Company LLC (the _n2 indicates, 'has invested with the VC two observations below this observation)
Code:
gen Prior_Tie_n2 = 0
replace Prior_Tie_n2 =1 if SyndicateNumber FirmName[`i'] = SyndicateNumber FirmName[`i'+2] & inrange(InvestmentDate[`i'],InvestmentDate-1825, InvestmentDate-0)
I get, however, the following outcome:

Code:
invalid 'FirmName'
r(198);
Even though I got an error here, I had already thought about how to create a loop to do it for each observation.

Code:
forval i = 1/`=_N' {
replace Prior_Tie_n1 =1 if SyndicateNumber FirmName[`i'] = SyndicateNumber FirmName[`i'+1] & inrange(InvestmentDate[`i'],InvestmentDate-1825, InvestmentDate-0)
replace Prior_Tie_n1 = r(N) in `i'
}

invalid 'FirmName'
r(198);

forval i = 1/`=_N' {
replace Prior_Tie_n2 =1 if SyndicateNumber FirmName[`i'] = SyndicateNumber FirmName[`i'+2] inrange(InvestmentDate[`i'],InvestmentDate-1825, InvestmentDate-0)
replace Prior_Tie_n2 = r(N) in `i'
}

invalid 'FirmName'
r(198);

Questions
  • Could somebody help me how to set up a loop that calculates if VC 1 (e.g. Canaan Partners) has at least once the same SyndicateNumber as VC 2 (e.g. Sigma Partners), in the five years before the InvestmentDate until the InvestmentDate. The investment they made together at InvestmentDate should be excluded. The variable Prior_Tie_n1 should become '1', if the VCs had co-invested in that timeframe, if not, it should become '0'
  • Could somebody help me how to set up a loop that calculates if VC 1 (e.g. Canaan Partners) has at least once the same SyndicateNumber as VC3 (e.g. CMEA Development Company LLC). The investment they made together at InvestmentDate should be excluded. The variable Prior_Tie_n2 should become '1', if the VCs had co-invested in that timeframe, if not, it should become '0'
There is one requirement that I have not added in the loop yet, as I do not know how to do it. As there are many groups (= VCs have the same SyndicateNumber), I only want to calculate if, for example,

VC 1 in group A has co-invested with VC2 in group A
VC 1 in group A has co-invested with VC3 in group A
VC 2 in group A has co-invested with VC 3 in group A

VC1 in group B has co-invested with VC2 in group B
VC1 in group B has co-invested with VC3 in group B
VC2 in group B has co-invested with VC3 in group B

I think that I need to add something to the loop that the [`i'+1] or [`i'+2] only 'works' if the VCs are in the same group (e.g. both in group A)

I hope my explanation is clear and that somebody can help me. If not, I am - of course - more than happy to clarify anything.

Code:
 * Example generated by -dataex-. To install: ssc install dataex
clear
input str60 CompanyName str59 FirmName int InvestmentDate float SyndicateNumber
"0-In Design Automation, Inc."                              "Sigma Partners"                     13605  1
"0-In Design Automation, Inc."                              "Canaan Partners"                    14146  2
"0-In Design Automation, Inc."                              "Sigma Partners"                     14146  2
"0-In Design Automation, Inc."                              "CMEA Development Company LLC"       14146  2
"0-In Design Automation, Inc."                              "Skywood Ventures LLC"               14777  3
"0-In Design Automation, Inc."                              "Canaan Partners"                    14777  3
"0-In Design Automation, Inc."                              "Adams Street Partners LLC"          14777  3
"0-In Design Automation, Inc."                              "CMEA Development Company LLC"       14777  3
"0-In Design Automation, Inc."                              "Sigma Partners"                     14777  3
"0-In Design Automation, Inc."                              "Adams Street Partners LLC"          15309  4
"0-In Design Automation, Inc."                              "Sigma Partners"                     15309  4
"0-In Design Automation, Inc."                              "Canaan Partners"                    15309  4
"0-In Design Automation, Inc."                              "CMEA Development Company LLC"       15309  4
"1 800 Present"                                             "Undisclosed Firm"                   13605  5
"1 Tier Communications  Ltd"                                "Undisclosed Firm"                   14984  6
"1-800-Batteries"                                           "Undisclosed Firm"                   13331  7
"1-800-Batteries"                                           "Wand Partners Inc"                  13331  7
"1-800-Batteries"                                           "Institutional Venture Partners"     14153  8
"1-800-Flowers.com, Inc."                                   "Softbank Capital Partners L P"      14365  9
"1-800-Flowers.com, Inc."                                   "Benchmark Capital"                  14365  9
"1-800-Pack-Rat LLC"                                        "Envest Private Equity"              17241 10
"100% Nl"                                                   "Alta Communications Inc"            17210 11
"1000 Markets, Inc."                                        "True Ventures LLC"                  18036 12
"1000 Markets, Inc."                                        "Founders Fund, The"                 18036 12
"1000Memories, Inc."                                        "Felicis Ventures"                   18571 13
"1000Memories, Inc."                                        "Greylock Partners LLC"              18674 14
"1001 Listes"                                               "Undisclosed Firm"                   15249 15
"100Plus"                                                   "Felicis Ventures"                   18961 16
"100Plus"                                                   "Founders Fund, The"                 18961 16
"100Plus"                                                   "Greylock Partners LLC"              18961 16
"100duCom (Aka  100duTv)"                                   "Undisclosed Firm"                   19292 17
"1010data Inc"                                              "Norwest Venture Partners"           18325 18
"101communications LLC"                                     "Undisclosed Firm"                   14221 19
"101communications LLC"                                     "Undisclosed Firm"                   14221 19
"101communications LLC"                                     "Frontenac Company LLC"              14909 20
"101communications LLC"                                     "Frontenac Company LLC"              15336 21
"101communications LLC"                                     "Undisclosed Firm"                   15336 21
"101communications LLC"                                     "Frontenac Company LLC"              15336 21
"101communications LLC"                                     "Frontenac Company LLC"              15910 22
"101communications LLC"                                     "Frontenac Company LLC"              15910 22
"101communications LLC"                                     "Alta Communications Inc"            16898 23
"1020 Inc"                                                  "ONSET Ventures"                     17386 24
"1020 Inc"                                                  "Voyager Capital LLC"                17386 24
"1020 Inc"                                                  "Voyager Capital LLC"                17888 25
"1020 Inc"                                                  "ONSET Ventures"                     18219 26
"1020 Inc"                                                  "Undisclosed Firm"                   18219 26
"1020 Inc"                                                  "Voyager Capital LLC"                18219 26
"1020 Inc"                                                  "ONSET Ventures"                     18345 27
"1020 Inc"                                                  "Undisclosed Firm"                   18345 27
"1020 Inc"                                                  "Voyager Capital LLC"                18345 27
"10C Technologies Inc"                                      "STARTech Early Ventures"            16741 28
"10x Technology LLC"                                        "Independence Equity Management LLC" 18844 29
"11 West 42nd Street"                                       "WH Advisors Inc"                    13515 30
"1105 Media Inc"                                            "Alta Communications Inc"            17454 31
"110sport Management Ltd (Fka  Sportsmasters Network  Ltd)" "Warburg Pincus LLC"                 14610 32
"110sport Management Ltd (Fka  Sportsmasters Network  Ltd)" "Warburg Pincus LLC"                 14610 32
"110sport Management Ltd (Fka  Sportsmasters Network  Ltd)" "Warburg Pincus LLC"                 14706 33
"123 Investment Managers SA"                                "Partech Partners"                   14971 34
"123Greetings.com"                                          "Intel Capital Corp"                 17549 35
"123indiaCom Pte Ltd"                                       "Undisclosed Firm"                   14757 36
"123signup Ams  Inc"                                        "Scale Venture Partners"             14672 37
"123signup Ams  Inc"                                        "ONSET Ventures"                     14672 37
"12degrees"                                                 "Angel Investors, LP"                14396 38
"12snap AG"                                                 "Bluerun Ventures LP"                14873 39
"12snap AG"                                                 "Undisclosed Firm"                   14873 39
"12snap AG"                                                 "Argo Global Capital, Inc."          14873 39
"12snap AG"                                                 "Undisclosed Firm"                   14873 39
"1366 Technologies Inc"                                     "North Bridge Venture Partners LP"   17521 40
"1366 Technologies Inc"                                     "Polaris Growth Management LLC"      17521 40
"1366 Technologies Inc"                                     "Polaris Growth Management LLC"      18284 41
"1366 Technologies Inc"                                     "North Bridge Venture Partners LP"   18284 41
"1366 Technologies Inc"                                     "North Bridge Venture Partners LP"   18611 42
"1366 Technologies Inc"                                     "Polaris Growth Management LLC"      18611 42
"1366 Technologies Inc"                                     "Polaris Growth Management LLC"      18641 43
"1366 Technologies Inc"                                     "North Bridge Venture Partners LP"   18641 43
"1366 Technologies Inc"                                     "Vantagepoint Management Inc"        18641 43
"1366 Technologies Inc"                                     "Energy Technology Ventures"         19704 44
"1366 Technologies Inc"                                     "Polaris Growth Management LLC"      19704 44
"1366 Technologies Inc"                                     "Vantagepoint Management Inc"        19704 44
"1366 Technologies Inc"                                     "North Bridge Venture Partners LP"   19704 44
"14 South Networks"                                         "HIG Capital LLC"                    14931 45
"14 South Networks"                                         "Crossbow Ventures Inc"              14931 45
"14 South Networks"                                         "Navigation Capital Partners Inc"    15131 46
"14 South Networks"                                         "HIG Capital LLC"                    15131 46
"14 South Networks"                                         "Crossbow Ventures Inc"              15131 46
"14 South Networks"                                         "Navigation Capital Partners Inc"    15606 47
"14 South Networks"                                         "Crossbow Ventures Inc"              15606 47
"14 South Networks"                                         "Crossbow Ventures Inc"              15778 48
"14 South Networks"                                         "Navigation Capital Partners Inc"    15778 48
"14 South Networks"                                         "Navigation Capital Partners Inc"    15907 49
"14 South Networks"                                         "Crossbow Ventures Inc"              15907 49
"14 South Networks"                                         "Navigation Capital Partners Inc"    16054 50
"14 South Networks"                                         "Crossbow Ventures Inc"              16054 50
"14 South Networks"                                         "Navigation Capital Partners Inc"    16160 51
"14 South Networks"                                         "Crossbow Ventures Inc"              16160 51
"14 South Networks"                                         "Crossbow Ventures Inc"              16315 52
"140 Proof, Inc."                                           "Bluerun Ventures LP"                18745 53
"140 Proof, Inc."                                           "Founders Fund, The"                 18745 53
"140 Proof, Inc."                                           "SV Angel"                           18745 53
"140 Proof, Inc."                                           "Bluerun Ventures LP"                18900 54
end
format %td InvestmentDate