Announcement

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

  • #16
    I don't know anything about the Global Terrorism Database. You say you believe it is complete. If that is true, then you can replace the terrorism event, death, injuries and casualties variables with zeroes and keep them in the analysis.

    Comment


    • #17
      I will take that into account!
      I also want to merge GDP variables into these data set and distance between countries.
      First I need to reshape it to wide, so I get for every country and year the gdp.

      I tried the following: - reshape wide gdp1980 gdp1981, i(str_country year) j(gdp1980) -
      But it didn't work.

      there are more GDP variables from 1980 till 2016.

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str52 str_country double(gdp1980 gdp1981 gdp1982 gdp2016)
      "Aruba"                                                          .                  .                  .                  .
      "Afghanistan"                                    3641723321.995465  3478787909.090909                  . 19469022207.635742
      "Angola"                                                         .                  .                  .  95335111741.20247
      "Albania"                                                        .                  .                  . 11863865978.094248
      "Andorra"                                        446416105.8250174  388958731.3029375  375895956.3834621  2858517699.115044
      "Arab World"                                     338177454717.5393 348592795413.11597 324328753765.29926 2504702625568.6313
      "United Arab Emirates"                           43598748449.04785  49333424135.11305  46622718605.28467   348743265704.561
      "Argentina"                                      76961923741.94785  78676842366.42133  84307486836.72403  545476103427.2472
      "Armenia"                                                        .                  .                  .  10572298341.56177
      "American Samoa"                                                 .                  .                  .          6.580e+08
      "Antigua and Barbuda"                           131431037.03703703 147841740.74074072  164369296.2962963 1460144703.7037034
      "Australia"                                      149887465181.0585  176804829908.2782  193954540439.1482 1204616439828.4082
      "Austria"                                        82058912465.43288  71034228097.45982  71275287327.57925  390799991147.4675
      "Azerbaijan"                                                     .                  .                  .  37847715736.04061
      "Burundi"                                        919726666.6666665  969046666.6666666 1013222222.2222222  3007029030.400097
      "Belgium"                                       127508202372.74107 105290614080.83443  92588895020.30725 467955709817.53906
      "Benin"                                         1405251547.2388248 1291119965.1126204 1267778489.0307946  8583031398.216753
      "Burkina Faso"                                  1928720390.2886932  1775842679.940559  1754450379.207696 11693235542.067104
      "Bangladesh"                                    18138049095.607235  20249694002.44798 18525399201.596806 221415162445.64813
      "Bulgaria"                                       19839230769.23077 19870000000.000004 19342000000.000004  53237882472.71082
      "Bahrain"                                         3072698328.46909  3467819148.936171 3645744680.8510637  32179069148.93617
      "Bahamas, The"                                          1.3353e+09 1426500000.0000002 1578300000.0000002 11261799999.999998
      "Bosnia and Herzegovina"                                         .                  .                  .  16910277133.64629
      "Belarus"                                                        .                  .                  .  47407217531.16204
      "Belize"                                                 194750000 192900000.00000003          179250000         1.7411e+09
      "Bermuda"                                                613299968          739100032          785500032                  .
      "Bolivia"                                        4537487842.577488  5891606676.182709  5594118400.167313  33806395513.74819
      "Brazil"                                        235024598983.26135 263561088977.12936  281682304161.0405 1796186586414.4456
      "Barbados"                                                       .                  .                  .         4529050000
      "Brunei Darussalam"                              4928824957.967495  4366213849.576372  4264252336.448598 11400653731.991602
      "Bhutan"                                         135653295.1653944 146391639.72286376 148934334.03805494 2212638830.3943877
      "Botswana"                                       1060923829.130211 1073861599.1394765 1014907254.5401573 15581137273.772797
      "Central African Republic"                       797048028.7732465  694803502.7223564  748312283.7267575 1756124677.1967065
      "Canada"                                        273853826377.00992 306214863624.98956  313506525087.1362   1535767736946.18
      "Central Europe and the Baltics"                                 .                  .                  . 1312191844364.8433
      "Switzerland"                                   119008334606.43314 108993981315.54832 111711490075.35832  668851296244.2357
      "Channel Islands"                                                .                  .                  .                  .
      "Chile"                                         29036709871.794872 34509878043.589745 25325893205.657043 247027912574.34998
      "China"                                               191149211575 195866382432.53967  205089699858.7786 11199145157649.184
      "Cote d'Ivoire"                                  10175615441.81265  8432588483.852627  7567109766.611292  36372613022.94197
      "Cameroon"                                       6740756568.915655  7636345827.343083   7322914570.15588  32217497470.48904
      "Congo, Dem. Rep."                              14394927492.964659 12537821039.825195 13651667370.546587  35381784773.82826
      "Congo, Rep."                                   1705796849.5465524 1993512325.9228613  2160640566.539598  7833508878.966598
      "Colombia"                                      33400735644.048115  36388366869.03093  38968039721.74803  282462551366.8777
      "Comoros"                                       123505640.91447373 114271897.26827195 107089552.30239484   616654490.413179
      "Cabo Verde"                                    142246875.53671572 139468114.59974083 140630758.59489855 1617467435.7700725
      "Costa Rica"                                     4831447001.166861 2623807074.2947984 2606621255.0158124    57435507212.256
      "Caribbean small states"                        14028282040.668892 15480050142.600813 17287146828.896706  66707362091.37796
      "Cuba"                                           19912889861.11111 20150254096.385544 20953510235.294117                  .
      "Curacao"                                                        .                  .                  .                  .
      "Cayman Islands"                                                 .                  .                  .                  .
      "Cyprus"                                        2154311276.9485903 2087496373.7796376   2159242416.76942  20047013274.33628
      "Czech Republic"                                                 .                  .                  . 195305084919.13815
      "Germany"                                        946695355820.9597  797443405711.8131  773638200773.7568 3477796274496.8037
      "Djibouti"                                                       .                  .                  .                  .
      "Dominica"                                       59099999.99999999   66218518.5185185  72051851.85185184  581484031.8518518
      "Denmark"                                        71127592753.59747 61877755004.632614  60412846238.77875 306899653409.60144
      "Dominican Republic"                             6631000100.000001         7266999800         7964000300  71583553487.56456
      "Algeria"                                        42345277342.01955  44348672667.87154  45207088715.64827 159049096745.24936
      "East Asia & Pacific (excluding high income)"    379504541663.8398  405525611894.7829  425626144074.3751 13512337831001.553
      "Early-demographic dividend"                    1295401864990.7703 1447517165740.9028 1379491226141.9116  10401883574848.16
      "East Asia & Pacific"                           1811621650867.6206  2000329444928.526 1959327051358.2197 22489968123893.137
      "Europe & Central Asia (excluding high income)"                  .                  .                  .  2991823901020.519
      "Europe & Central Asia"                          4549120101079.413  4048966722470.866 3901660951920.7563   20278082039222.3
      "Ecuador"                                       17881514682.878384 21810767209.369484 19929853574.609524  98613971999.99999
      "Egypt, Arab Rep."                              22912500555.555557 23405404729.729736  25592365394.08867  332791045963.8069
      "Euro area"                                     2956937624588.2075 2569994236426.6636  2488146477597.512 11935082324134.672
      "Eritrea"                                                        .                  .                  .                  .
      "Spain"                                          232134606637.2708 202257045774.01337 195464408602.15054 1237255019653.8586
      "Estonia"                                                        .                  .                  .  23337907618.51736
      "Ethiopia"                                                       .  7324903188.405798  7707678019.323672  72374224249.39966
      "European Union"                                3861239352728.5283 3416534450611.2515  3288164387534.698  16491323140209.47
      "Fragile and conflict affected situations"                       .                  .                  .  748330117478.2736
      "Finland"                                        53685049410.26459   52485533204.7396 52832120389.786606 238677672281.61093
      "Fiji"                                           1202567359.413203 1235899836.1806693  1194015444.015444  4703632978.469471
      "France"                                         703525302701.0245  617589619794.8099   586837009681.605  2465453975282.239
      "Faroe Islands"                                                  .                  .                  .                  .
      "Micronesia, Fed. Sts."                                          .                  .                  .          329895600
      "Gabon"                                          4279637933.851256  3862269126.926422 3618007844.4491944 14213558130.181726
      "United Kingdom"                                 564947710899.3726  540765675241.1576  515048916841.3696 2650850178102.1426
      "Georgia"                                                        .                  .                  .  14378016729.15866
      "Ghana"                                          4445228057.453535 4222441673.1704917 4035994383.3836718  42689783733.87301
      "Gibraltar"                                                      .                  .                  .                  .
      "Guinea"                                                         .                  .                  .   8200248003.02206
      "Gambia, The"                                    241080708.8901801 218764445.78434327 216051495.95981658  964599178.1291022
      "Guinea-Bissau"                                 110653830.72603288  154731969.6969697 165523634.49691996 1164944509.9441884
      "Equatorial Guinea"                              50642880.77375034  36731422.84569139  44294647.73347897 10684804794.036144
      "Greece"                                        56829663469.224625   52346507380.0738  54617991326.53061 192690813126.86044
      "Grenada"                                       110900444.44444443 115651925.92592593 125435592.59259258 1056188592.5925924
      "Greenland"                                     476055288.41888607 435746974.75924414  402405069.3677692                  .
      "Guatemala"                                             7.8787e+09         8607500300         8716999700  68763255963.89426
      "Guam"                                                           .                  .                  .          5.793e+09
      "Guyana"                                                 6.032e+08  570357107.1428572          4.820e+08 3502397094.4309926
      "High income"                                    8901502055532.826  9039466322044.309   8953452845920.44  48580898467769.54
      "Hong Kong SAR, China"                           28861759209.01911 31055409443.042957 32291306281.816837 320910168377.92926
      "Honduras"                                              2566000050         2.8195e+09 2903500050.0000005 21516938909.568645
      "Heavily indebted poor countries (HIPC)"        105270795521.97958 104921751019.51558 104669856312.84181  651762255995.4592
      "Croatia"                                                        .                  .                  .  50714957390.53776
      "Haiti"                                                          .                  .                  .  8022638721.920126
      "Hungary"                                                        .                  .                  . 125816640420.56918
      end

      Comment


      • #18
        No, you don't want to reshape this GDP data wide. It is already wide, and to merge it to the other data sets you need to reshape it long.

        Code:
        reshape long gdp, i(str_country) j(year)
        Note: This will work properly, without modification, regardless of how many years worth of data there are in the real data set.

        Comment


        • #19
          really, I struggled for an hour to get to this outcome! You are like a Stata wizard, thank you so much!

          Comment

          Working...
          X