Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Try this:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float set int(_ID _ID_pair) str32 country1 str3 iso1 str23 region1 str32 country2 str3 iso2 str23 region2
    327 140 104 "Afghanistan"            "AFG" "Asia"     "China"                            "CHN" "Asia"    
    329 108 104 "Afghanistan"            "AFG" "Asia"     "Iran"                             "IRN" "Asia"    
    322 103 104 "Afghanistan"            "AFG" "Asia"     "Pakistan"                         "PAK" "Asia"    
    327 105 104 "Afghanistan"            "AFG" "Asia"     "Tajikistan"                       "TJK" "Asia"    
    330 107 104 "Afghanistan"            "AFG" "Asia"     "Turkmenistan"                     "TKM" "Asia"    
     28   7 104 "Afghanistan"            "AFG" "Asia"     "Uzbekistan"                       "UZB" "Asia"    
    412 124 126 "Albania"                "ALB" "Europe"   "Greece"                           "GRC" "Europe"  
    420 175 126 "Albania"                "ALB" "Europe"   "Kosovo"                           "-99" "Europe"  
    416 172 126 "Albania"                "ALB" "Europe"   "Macedonia"                        "MKD" "Europe"  
    418 174 126 "Albania"                "ALB" "Europe"   "Montenegro"                       "MNE" "Europe"  
    264 165  83 "Algeria"                "DZA" "Africa"   "Libya"                            "LBY" "Africa"  
    195  53  83 "Algeria"                "DZA" "Africa"   "Mali"                             "MLI" "Africa"  
    195  54  83 "Algeria"                "DZA" "Africa"   "Mauritania"                       "MRT" "Africa"  
     13 163  83 "Algeria"                "DZA" "Africa"   "Morocco"                          "MAR" "Africa"  
    218  56  83 "Algeria"                "DZA" "Africa"   "Niger"                            "NER" "Africa"  
    264  82  83 "Algeria"                "DZA" "Africa"   "Tunisia"                          "TUN" "Africa"  
     11   3  83 "Algeria"                "DZA" "Africa"   "Western Sahara"                   "ESH" "Africa"  
     52  12  75 "Angola"                 "AGO" "Africa"   "Democratic Republic of the Congo" "COD" "Africa"  
    186  51  75 "Angola"                 "AGO" "Africa"   "Namibia"                          "NAM" "Africa"  
     52  68  75 "Angola"                 "AGO" "Africa"   "Republic of the Congo"            "COG" "Africa"  
    250  71  75 "Angola"                 "AGO" "Africa"   "Zambia"                           "ZMB" "Africa"  
     37  31  10 "Argentina"              "ARG" "Americas" "Bolivia"                          "BOL" "Americas"
     42  30  10 "Argentina"              "ARG" "Americas" "Brazil"                           "BRA" "Americas"
     38  11  10 "Argentina"              "ARG" "Americas" "Chile"                            "CHL" "Americas"
     41 157  10 "Argentina"              "ARG" "Americas" "Paraguay"                         "PRY" "Americas"
     39  29  10 "Argentina"              "ARG" "Americas" "Uruguay"                          "URY" "Americas"
    345 146 110 "Armenia"                "ARM" "Asia"     "Azerbaijan"                       "AZE" "Asia"    
    344 147 110 "Armenia"                "ARM" "Asia"     "Georgia"                          "GEO" "Asia"    
    338 108 110 "Armenia"                "ARM" "Asia"     "Iran"                             "IRN" "Asia"    
    343 125 110 "Armenia"                "ARM" "Asia"     "Turkey"                           "TUR" "Asia"    
    373 154 115 "Austria"                "AUT" "Europe"   "Czechia"                          "CZE" "Europe"  
    374 122 115 "Austria"                "AUT" "Europe"   "Germany"                          "DEU" "Europe"  
    370 116 115 "Austria"                "AUT" "Europe"   "Hungary"                          "HUN" "Europe"  
    375 142 115 "Austria"                "AUT" "Europe"   "Italy"                            "ITA" "Europe"  
    380 153 115 "Austria"                "AUT" "Europe"   "Slovakia"                         "SVK" "Europe"  
    379 151 115 "Austria"                "AUT" "Europe"   "Slovenia"                         "SVN" "Europe"  
    372 128 115 "Austria"                "AUT" "Europe"   "Switzerland"                      "CHE" "Europe"  
    345 110 146 "Azerbaijan"             "AZE" "Asia"     "Armenia"                          "ARM" "Asia"    
    433 147 146 "Azerbaijan"             "AZE" "Asia"     "Georgia"                          "GEO" "Asia"    
    337 108 146 "Azerbaijan"             "AZE" "Asia"     "Iran"                             "IRN" "Asia"    
    112  19 146 "Azerbaijan"             "AZE" "Asia"     "Russia"                           "RUS" "Europe"  
    337 125 146 "Azerbaijan"             "AZE" "Asia"     "Turkey"                           "TUR" "Asia"    
    312  99 100 "Bangladesh"             "BGD" "Asia"     "India"                            "IND" "Asia"    
    303  94 100 "Bangladesh"             "BGD" "Asia"     "Myanmar"                          "MMR" "Asia"    
    102 120 112 "Belarus"                "BLR" "Europe"   "Latvia"                           "LVA" "Europe"  
    349 119 112 "Belarus"                "BLR" "Europe"   "Lithuania"                        "LTU" "Europe"  
    349 114 112 "Belarus"                "BLR" "Europe"   "Poland"                           "POL" "Europe"  
    101  19 112 "Belarus"                "BLR" "Europe"   "Russia"                           "RUS" "Europe"  
    347 113 112 "Belarus"                "BLR" "Europe"   "Ukraine"                          "UKR" "Europe"  
    174  44 130 "Belgium"                "BEL" "Europe"   "France"                           "-99" "Europe"  
    400 122 130 "Belgium"                "BEL" "Europe"   "Germany"                          "DEU" "Europe"  
    428 129 130 "Belgium"                "BEL" "Europe"   "Luxembourg"                       "LUX" "Europe"  
    400 131 130 "Belgium"                "BEL" "Europe"   "Netherlands"                      "NLD" "Europe"  
    163  39  40 "Belize"                 "BLZ" "Americas" "Guatemala"                        "GTM" "Americas"
    129  28  40 "Belize"                 "BLZ" "Americas" "Mexico"                           "MEX" "Americas"
    207  66  55 "Benin"                  "BEN" "Africa"   "Burkina Faso"                     "BFA" "Africa"  
    208  56  55 "Benin"                  "BEN" "Africa"   "Niger"                            "NER" "Africa"  
    209  57  55 "Benin"                  "BEN" "Africa"   "Nigeria"                          "NGA" "Africa"  
    210  59  55 "Benin"                  "BEN" "Africa"   "Togo"                             "TGO" "Africa"  
    320 140 101 "Bhutan"                 "BTN" "Asia"     "China"                            "CHN" "Asia"    
    313  99 101 "Bhutan"                 "BTN" "Asia"     "India"                            "IND" "Asia"    
     44  10  31 "Bolivia"                "BOL" "Americas" "Argentina"                        "ARG" "Americas"
    134  30  31 "Bolivia"                "BOL" "Americas" "Brazil"                           "BRA" "Americas"
     37  11  31 "Bolivia"                "BOL" "Americas" "Chile"                            "CHL" "Americas"
     43 157  31 "Bolivia"                "BOL" "Americas" "Paraguay"                         "PRY" "Americas"
     46  32  31 "Bolivia"                "BOL" "Americas" "Peru"                             "PER" "Americas"
    424 127 171 "Bosnia and Herzegovina" "BIH" "Europe"   "Croatia"                          "HRV" "Europe"  
    449 174 171 "Bosnia and Herzegovina" "BIH" "Europe"   "Montenegro"                       "MNE" "Europe"  
    422 173 171 "Bosnia and Herzegovina" "BIH" "Europe"   "Republic of Serbia"               "SRB" "Europe"  
    183  51  50 "Botswana"               "BWA" "Africa"   "Namibia"                          "NAM" "Africa"  
    124  26  50 "Botswana"               "BWA" "Africa"   "South Africa"                     "ZAF" "Africa"  
    182  71  50 "Botswana"               "BWA" "Africa"   "Zambia"                           "ZMB" "Africa"  
    178  49  50 "Botswana"               "BWA" "Africa"   "Zimbabwe"                         "ZWE" "Africa"  
     42  10  30 "Brazil"                 "BRA" "Americas" "Argentina"                        "ARG" "Americas"
    135  31  30 "Brazil"                 "BRA" "Americas" "Bolivia"                          "BOL" "Americas"
    138  33  30 "Brazil"                 "BRA" "Americas" "Colombia"                         "COL" "Americas"
    146  44  30 "Brazil"                 "BRA" "Americas" "France"                           "-99" "Europe"  
    143  42  30 "Brazil"                 "BRA" "Americas" "Guyana"                           "GUY" "Americas"
     41 157  30 "Brazil"                 "BRA" "Americas" "Paraguay"                         "PRY" "Americas"
    136  32  30 "Brazil"                 "BRA" "Americas" "Peru"                             "PER" "Americas"
    142  43  30 "Brazil"                 "BRA" "Americas" "Suriname"                         "SUR" "Americas"
    132  29  30 "Brazil"                 "BRA" "Americas" "Uruguay"                          "URY" "Americas"
    138  41  30 "Brazil"                 "BRA" "Americas" "Venezuela"                        "VEN" "Americas"
    434 149 150 "Brunei"                 "BRN" "Asia"     "Malaysia"                         "MYS" "Asia"    
    404 124 123 "Bulgaria"               "BGR" "Europe"   "Greece"                           "GRC" "Europe"  
    408 172 123 "Bulgaria"               "BGR" "Europe"   "Macedonia"                        "MKD" "Europe"  
    408 173 123 "Bulgaria"               "BGR" "Europe"   "Republic of Serbia"               "SRB" "Europe"  
    392 118 123 "Bulgaria"               "BGR" "Europe"   "Romania"                          "ROU" "Europe"  
    404 125 123 "Bulgaria"               "BGR" "Europe"   "Turkey"                           "TUR" "Asia"    
    207  55  66 "Burkina Faso"           "BFA" "Africa"   "Benin"                            "BEN" "Africa"  
    228  60  66 "Burkina Faso"           "BFA" "Africa"   "Ghana"                            "GHA" "Africa"  
    201  61  66 "Burkina Faso"           "BFA" "Africa"   "Ivory Coast"                      "CIV" "Africa"  
    204  53  66 "Burkina Faso"           "BFA" "Africa"   "Mali"                             "MLI" "Africa"  
    207  56  66 "Burkina Faso"           "BFA" "Africa"   "Niger"                            "NER" "Africa"  
    210  59  66 "Burkina Faso"           "BFA" "Africa"   "Togo"                             "TGO" "Africa"  
     57  12  76 "Burundi"                "BDI" "Africa"   "Democratic Republic of the Congo" "COD" "Africa"  
    253 170  76 "Burundi"                "BDI" "Africa"   "Rwanda"                           "RWA" "Africa"  
      7   2  76 "Burundi"                "BDI" "Africa"   "United Republic of Tanzania"      "TZA" "Africa"  
    291  93  91 "Cambodia"               "KHM" "Asia"     "Laos"                             "LAO" "Asia"    
    290  92  91 "Cambodia"               "KHM" "Asia"     "Thailand"                         "THA" "Asia"    
    end
    
    tempfile neighbors
    save `neighbors'
    
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str44 A_country int A_year str17 D1_Disastertype
    "Afghanistan"         1991 "Earthquake"       
    "Afghanistan"         1991 "Flood"            
    "Afghanistan"         1991 "Earthquake"       
    "Afghanistan"         1991 "Flood"            
    "Afghanistan"         1991 "Flood"            
    "Afghanistan"         1992 "Earthquake"       
    "Afghanistan"         1992 "Flood"            
    "Afghanistan"         1992 "Flood"            
    "Afghanistan"         1993 "Landslide"        
    "Afghanistan"         1993 "Landslide"        
    "Afghanistan"         1993 "Storm"            
    "Afghanistan"         1994 "Earthquake"       
    "Afghanistan"         1995 "Flood"            
    "Afghanistan"         1995 "Landslide"        
    "Afghanistan"         1995 "Flood"            
    "Afghanistan"         1996 "Earthquake"       
    "Afghanistan"         1996 "Flood"            
    "Afghanistan"         1997 "Earthquake"       
    "Afghanistan"         1997 "Flood"            
    "Afghanistan"         1997 "Flood"            
    "Afghanistan"         1997 "Landslide"        
    "Afghanistan"         1998 "Earthquake"       
    "Afghanistan"         1998 "Flood"            
    "Afghanistan"         1998 "Epidemic"         
    "Afghanistan"         1998 "Epidemic"         
    "Afghanistan"         1998 "Landslide"        
    "Afghanistan"         1998 "Earthquake"       
    "Afghanistan"         1998 "Earthquake"       
    "Afghanistan"         1999 "Flood"            
    "Afghanistan"         1999 "Epidemic"         
    "Afghanistan"         1999 "Epidemic"         
    "Afghanistan"         1999 "Wildfire"         
    "Afghanistan"         1999 "Earthquake"       
    "Afghanistan"         2000 "Epidemic"         
    "Afghanistan"         2000 "Epidemic"         
    "Afghanistan"         2000 "Drought"          
    "Afghanistan"         2000 "Epidemic"         
    "Afghanistan"         2000 "Epidemic"         
    "Afghanistan"         2001 "Epidemic"         
    "Afghanistan"         2001 "Epidemic"         
    "Afghanistan"         2001 "Earthquake"       
    "Afghanistan"         2001 "Earthquake"       
    "Afghanistan"         2002 "Flood"            
    "Afghanistan"         2002 "Epidemic"         
    "Afghanistan"         2002 "Flood"            
    "Afghanistan"         2002 "Epidemic"         
    "Afghanistan"         2002 "Earthquake"       
    "Afghanistan"         2002 "Earthquake"       
    "Afghanistan"         2002 "Epidemic"         
    "Afghanistan"         2002 "Epidemic"         
    "Afghanistan"         2002 "Landslide"        
    "Afghanistan"         2002 "Epidemic"         
    "Afghanistan"         2002 "Earthquake"       
    "Afghanistan"         2002 "Epidemic"         
    "Afghanistan"         2002 "Flood"            
    "Afghanistan"         2002 "Epidemic"         
    "Afghanistan"         2002 "Flood"            
    "Afghanistan"         2002 "Epidemic"         
    "Afghanistan"         2003 "Flood"            
    "Afghanistan"         2003 "Flood"            
    "Afghanistan"         2003 "Earthquake"       
    "Afghanistan"         2003 "Flood"            
    "Afghanistan"         2003 "Flood"            
    "Afghanistan"         2003 "Flood"            
    "Afghanistan"         2003 "Flood"            
    "Afghanistan"         2003 "Flood"            
    "Afghanistan"         2003 "Flood"            
    "Afghanistan"         2004 "Earthquake"       
    "Afghanistan"         2004 "Flood"            
    "Afghanistan"         2004 "Flood"            
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Storm"            
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Earthquake"       
    "Afghanistan"         2005 "Earthquake"       
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Flood"            
    "Afghanistan"         2005 "Epidemic"         
    "Afghanistan"         2006 "Flood"            
    "Afghanistan"         2006 "Storm"            
    "Afghanistan"         2006 "Landslide"        
    "Afghanistan"         2006 "Flood"            
    "Afghanistan"         2006 "Flood"            
    "Afghanistan"         2006 "Drought"          
    "Afghanistan"         2006 "Flood"            
    "Afghanistan"         2006 "Landslide"        
    "Afghanistan"         2006 "Flood"            
    "Afghanistan"         2006 "Earthquake"       
    "Afghanistan"         2006 "Flood"            
    "Afghanistan"         2006 "Storm"            
    "Afghanistan"         2006 "Flood"            
    "Afghanistan"         2007 "Flood"            
    "Afghanistan"         2007 "Flood"            
    "Afghanistan"         2007 "Flood"            
    "Afghanistan"         2007 "Flood"            
    "Afghanistan"         2007 "Flood"            
    "Afghanistan"         2007 "Flood"            
    "Afghanistan"         2007 "Flood"            
    "Afghanistan"         2008 "Epidemic"         
    "Afghanistan"         2008 "Drought"          
    "Afghanistan"         2008 "Flood"            
    "Afghanistan"         2009 "Earthquake"       
    "Afghanistan"         2009 "Flood"            
    "Afghanistan"         2009 "Flood"            
    "Afghanistan"         2009 "Landslide"        
    "Afghanistan"         2009 "Flood"            
    "Afghanistan"         2010 "Earthquake"       
    "Afghanistan"         2010 "Landslide"        
    "Afghanistan"         2010 "Flood"            
    "Afghanistan"         2010 "Landslide"        
    "Afghanistan"         2010 "Flood"            
    "Afghanistan"         2011 "Flood"            
    "Afghanistan"         2011 "Storm"            
    "Afghanistan"         2011 "Flood"            
    "Afghanistan"         2011 "Drought"          
    "Afghanistan"         2012 "Flood"            
    "Afghanistan"         2012 "Landslide"        
    "Afghanistan"         2012 "Landslide"        
    "Afghanistan"         2012 "Landslide"        
    "Afghanistan"         2012 "Flood"            
    "Afghanistan"         2012 "Flood"            
    "Afghanistan"         2012 "Flood"            
    "Afghanistan"         2012 "Flood"            
    "Afghanistan"         2012 "Flood"            
    "Afghanistan"         2012 "Earthquake"       
    "Afghanistan"         2013 "Flood"            
    "Afghanistan"         2013 "Flood"            
    "Afghanistan"         2013 "Earthquake"       
    "Afghanistan"         2013 "Flood"            
    "Afghanistan"         2013 "Landslide"        
    "Afghanistan"         2013 "Flood"            
    "Afghanistan"         2014 "Flood"            
    "Afghanistan"         2014 "Flood"            
    "Afghanistan"         2014 "Storm"            
    "Afghanistan"         2015 "Landslide"        
    "Afghanistan"         2015 "Earthquake"       
    "Afghanistan"         2015 "Landslide"        
    "Afghanistan"         2015 "Landslide"        
    "Afghanistan"         2015 "Landslide"        
    "Afghanistan"         2015 "Earthquake"       
    "Afghanistan"         2015 "Flood"            
    "Afghanistan"         2016 "Flood"            
    "Afghanistan"         2016 "Flood"            
    "Afghanistan"         2016 "Flood"            
    "Afghanistan"         2016 "Flood"            
    "Albania"             1992 "Flood"            
    "Albania"             1995 "Flood"            
    "Albania"             1995 "Flood"            
    "Albania"             1996 "Epidemic"         
    "Albania"             1997 "Flood"            
    "Albania"             1998 "Earthquake"       
    "Albania"             2002 "Storm"            
    "Albania"             2002 "Flood"            
    "Albania"             2002 "Epidemic"         
    "Albania"             2004 "Flood"            
    "Albania"             2005 "Flood"            
    "Albania"             2005 "Storm"            
    "Albania"             2007 "Wildfire"         
    "Albania"             2009 "Earthquake"       
    "Albania"             2009 "Flood"            
    "Albania"             2010 "Flood"            
    "Albania"             2015 "Flood"            
    "Albania"             2015 "Flood"            
    "Albania"             2015 "Flood"            
    "Albania"             2016 "Flood"            
    "Algeria"             1991 "Epidemic"         
    "Algeria"             1992 "Earthquake"       
    "Algeria"             1992 "Flood"            
    "Algeria"             1993 "Flood"            
    "Algeria"             1993 "Landslide"        
    "Algeria"             1994 "Flood"            
    "Algeria"             1994 "Flood"            
    "Algeria"             1994 "Wildfire"         
    "Algeria"             1994 "Earthquake"       
    "Algeria"             1996 "Flood"            
    "Algeria"             1997 "Epidemic"         
    "Algeria"             1997 "Flood"            
    "Algeria"             1999 "Earthquake"       
    "Algeria"             1999 "Flood"            
    "Algeria"             2000 "Flood"            
    "Algeria"             2000 "Flood"            
    "Algeria"             2000 "Storm"            
    "Algeria"             2000 "Flood"            
    "Algeria"             2000 "Flood"            
    "Algeria"             2001 "Flood"            
    "Algeria"             2002 "Flood"            
    "Algeria"             2002 "Flood"            
    "Algeria"             2002 "Flood"            
    "Algeria"             2003 "Storm"            
    "Algeria"             2003 "Earthquake"       
    "Algeria"             2003 "Earthquake"       
    "Algeria"             2003 "Flood"            
    "Algeria"             2003 "Flood"            
    "Algeria"             2003 "Flood"            
    "Algeria"             2004 "Flood"            
    "Algeria"             2004 "Earthquake"       
    "Algeria"             2004 "Earthquake"       
    "Algeria"             2004 "Flood"            
    "Algeria"             2005 "Storm"            
    "Algeria"             2005 "Flood"            
    "Algeria"             2005 "Flood"            
    "Algeria"             2006 "Flood"            
    "Algeria"             2006 "Earthquake"       
    "Algeria"             2007 "Flood"            
    "Algeria"             2007 "Flood"            
    "Algeria"             2007 "Flood"            
    "Algeria"             2007 "Flood"            
    "Algeria"             2007 "Wildfire"         
    "Algeria"             2007 "Flood"            
    "Algeria"             2007 "Flood"            
    "Algeria"             2008 "Flood"            
    "Algeria"             2009 "Flood"            
    "Algeria"             2009 "Flood"            
    "Algeria"             2011 "Flood"            
    "Algeria"             2012 "Flood"            
    "Algeria"             2012 "Flood"            
    "Algeria"             2014 "Earthquake"       
    "Algeria"             2015 "Flood"            
    "Algeria"             2015 "Flood"            
    "American Samoa"      2003 "Flood"            
    "American Samoa"      2004 "Storm"            
    "American Samoa"      2005 "Storm"            
    "American Samoa"      2009 "Earthquake"       
    "Angola"              1995 "Epidemic"         
    "Angola"              1997 "Drought"          
    "Angola"              1998 "Epidemic"         
    "Angola"              1999 "Epidemic"         
    "Angola"              1999 "Epidemic"         
    "Angola"              2000 "Landslide"        
    "Angola"              2000 "Epidemic"         
    "Angola"              2000 "Flood"            
    "Angola"              2000 "Flood"            
    "Angola"              2000 "Flood"            
    "Angola"              2000 "Flood"            
    "Angola"              2001 "Flood"            
    "Angola"              2001 "Flood"            
    "Angola"              2001 "Epidemic"         
    "Angola"              2001 "Epidemic"         
    "Angola"              2001 "Drought"          
    "Angola"              2002 "Flood"            
    "Angola"              2003 "Flood"            
    "Angola"              2003 "Flood"            
    "Angola"              2004 "Epidemic"         
    "Angola"              2004 "Flood"            
    "Angola"              2004 "Flood"            
    "Angola"              2004 "Drought"          
    "Angola"              2004 "Flood"            
    "Angola"              2005 "Flood"            
    "Angola"              2006 "Epidemic"         
    "Angola"              2006 "Epidemic"         
    "Angola"              2006 "Flood"            
    "Angola"              2007 "Epidemic"         
    "Angola"              2007 "Flood"            
    "Angola"              2007 "Flood"            
    "Angola"              2007 "Epidemic"         
    "Angola"              2008 "Flood"            
    "Angola"              2008 "Epidemic"         
    "Angola"              2008 "Epidemic"         
    "Angola"              2009 "Flood"            
    "Angola"              2009 "Epidemic"         
    "Angola"              2009 "Flood"            
    "Angola"              2009 "Flood"            
    "Angola"              2009 "Epidemic"         
    "Angola"              2010 "Flood"            
    "Angola"              2010 "Flood"            
    "Angola"              2010 "Flood"            
    "Angola"              2011 "Flood"            
    "Angola"              2011 "Flood"            
    "Angola"              2011 "Flood"            
    "Angola"              2011 "Flood"            
    "Angola"              2012 "Drought"          
    "Angola"              2013 "Flood"            
    "Angola"              2015 "Epidemic"         
    "Angola"              2015 "Flood"            
    "Angola"              2015 "Flood"            
    "Angola"              2015 "Flood"            
    "Angola"              2016 "Flood"            
    "Angola"              2016 "Flood"            
    "Angola"              2016 "Flood"            
    "Angola"              2016 "Flood"            
    "Anguilla"            1999 "Storm"            
    "Antigua and Barbuda" 1990 "Storm"            
    "Antigua and Barbuda" 1995 "Storm"            
    "Antigua and Barbuda" 1998 "Storm"            
    "Antigua and Barbuda" 1999 "Storm"            
    "Antigua and Barbuda" 1999 "Storm"            
    "Antigua and Barbuda" 2008 "Storm"            
    "Antigua and Barbuda" 2010 "Storm"            
    "Argentina"           1990 "Flood"            
    "Argentina"           1991 "Volcanic activity"
    "Argentina"           1992 "Epidemic"         
    "Argentina"           1992 "Flood"            
    "Argentina"           1992 "Flood"            
    "Argentina"           1993 "Flood"            
    "Argentina"           1993 "Flood"            
    "Argentina"           1993 "Flood"            
    "Argentina"           1993 "Storm"            
    "Argentina"           1994 "Wildfire"         
    "Argentina"           1995 "Storm"            
    "Argentina"           1995 "Flood"            
    "Argentina"           1995 "Flood"            
    "Argentina"           1997 "Flood"            
    "Argentina"           1998 "Storm"            
    "Argentina"           1998 "Flood"            
    "Argentina"           1999 "Wildfire"         
    "Argentina"           2000 "Wildfire"         
    "Argentina"           2000 "Storm"            
    "Argentina"           2000 "Flood"            
    "Argentina"           2000 "Flood"            
    "Argentina"           2000 "Flood"            
    "Argentina"           2000 "Flood"            
    "Argentina"           2000 "Storm"            
    "Argentina"           2001 "Flood"            
    "Argentina"           2001 "Storm"            
    "Argentina"           2001 "Flood"            
    "Argentina"           2001 "Storm"            
    "Argentina"           2001 "Wildfire"         
    "Argentina"           2001 "Flood"            
    "Argentina"           2002 "Flood"            
    "Argentina"           2002 "Earthquake"       
    "Argentina"           2002 "Flood"            
    "Argentina"           2002 "Storm"            
    "Argentina"           2003 "Drought"          
    "Argentina"           2003 "Storm"            
    "Argentina"           2003 "Flood"            
    "Argentina"           2003 "Flood"            
    "Argentina"           2004 "Flood"            
    "Argentina"           2004 "Flood"            
    "Argentina"           2005 "Storm"            
    "Argentina"           2006 "Flood"            
    "Argentina"           2007 "Flood"            
    "Argentina"           2007 "Flood"            
    "Argentina"           2008 "Volcanic activity"
    "Argentina"           2008 "Flood"            
    "Argentina"           2009 "Flood"            
    "Argentina"           2009 "Flood"            
    "Argentina"           2009 "Epidemic"         
    "Argentina"           2009 "Drought"          
    "Argentina"           2009 "Storm"            
    "Argentina"           2009 "Landslide"        
    "Argentina"           2011 "Volcanic activity"
    "Argentina"           2012 "Storm"            
    "Argentina"           2012 "Flood"            
    "Argentina"           2012 "Storm"            
    "Argentina"           2013 "Storm"            
    "Argentina"           2013 "Flood"            
    "Argentina"           2014 "Flood"            
    "Argentina"           2014 "Flood"            
    "Argentina"           2014 "Landslide"        
    "Argentina"           2014 "Flood"            
    "Argentina"           2015 "Flood"            
    "Argentina"           2015 "Volcanic activity"
    "Argentina"           2015 "Flood"            
    "Argentina"           2015 "Storm"            
    "Argentina"           2015 "Flood"            
    "Argentina"           2016 "Flood"            
    "Argentina"           2016 "Flood"            
    "Armenia"             1997 "Flood"            
    "Armenia"             1997 "Earthquake"       
    "Armenia"             1998 "Flood"            
    "Armenia"             2000 "Drought"          
    "Armenia"             2004 "Flood"            
    "Armenia"             2013 "Storm"            
    "Armenia"             2016 "Landslide"        
    "Azerbaijan"          1995 "Flood"            
    "Azerbaijan"          1995 "Flood"            
    "Azerbaijan"          1995 "Flood"            
    "Azerbaijan"          1997 "Flood"            
    "Azerbaijan"          1998 "Earthquake"       
    "Azerbaijan"          1999 "Earthquake"       
    "Azerbaijan"          2000 "Drought"          
    "Azerbaijan"          2000 "Earthquake"       
    "Azerbaijan"          2000 "Landslide"        
    "Azerbaijan"          2003 "Flood"            
    "Azerbaijan"          2009 "Flood"            
    end
    tempfile disasters
    save `disasters'
    
    use `disasters', clear
    clonevar country2 = A_country
    
    joinby country2 using `neighbors', unmatched(using)
    drop country2 iso2 region2
    The resulting data set will have all countries that appear as country1 in your first data set, and each such country will appear paired with every disaster that occurred in any of its neighboring countries. If there are no disasters in neighboring countries, the country just appears by itself as country1 in the results.

    I noticed your disasters data set has many duplicate entries. I suppose that a country can have sveral floods or several landslides or several earthquakes in the same year and that accounts for it.

    As for France appearing as a neighbor to Brazil, I can't help you with that. It may be an error in the geographic information file that is used in the code in #5, or perhaps an error in the code itself, though that code looks correct to me. Perhaps Robert Picard can shed light on this. Anyway, it might be simplest to just visually inspect your file of neighboring countries and -drop- any observations that are erroneous.

    Comment


    • #17
      This post has drawn my attention to this thread.

      As for France appearing as a neighbor to Brazil, I can't help you with that. It may be an error in the geographic information file that is used in the code in #5, or perhaps an error in the code itself, though that code looks correct to me. Perhaps Robert Picard can shed light on this.
      No error here. The once overseas territory of France, French Guiana, is now considered as a French region and borders Brazil.

      https://www.nationsonline.org/onewor...nch_guiana.htm

      Comment


      • #18
        Can the solution that Robert Picard develops in #5 be generalized to also identify neighbors of neighbors? It works well for polygon neighbors, but I would like to identify the next layer of neighbors as well. Thanks in advance!

        Comment

        Working...
        X