Announcement

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

  • Problems with creating newvar

    Hello All,

    I have a dyadic panel data-set that has the following variables: country a, country b, year and alliances between a and b (dichotomous). I want to calculate, by year, for each country a, the sum of alliances that each country b has with all countries that do not have an alliance with that given country a. I would like to loop that through all dyads.

    is this possible? Any tips on how I could do that?

    Many thanks!

  • #2
    Could you give me an example of what your data looks like with the dataex (install from SCC) plugin. I think I know what you want, and know how to do it. But I'm unsure from just the description of your data.

    Comment


    • #3
      Many thank, Jesse!

      Below I past how my first rows look like.

      The data continues in this format for for all years and all dyads.


      +----------------------------------------------------+
      | country_a country_b year defens~w |
      |----------------------------------------------------|
      1. | Afghanistan Turkey 1945 0 |
      2. | Afghanistan Iraq 1945 0 |
      3. | Afghanistan Iran 1945 0 |
      4. | Argentina Haiti 1945 1 |
      5. | Argentina Dominican Republic 1945 1 |
      |----------------------------------------------------|
      6. | Argentina United States 1945 1 |
      7. | Argentina Paraguay 1945 1 |
      8. | Argentina Cuba 1945 1 |
      9. | Argentina Venezuela 1945 1 |
      10. | Argentina Colombia 1945 1 |
      |----------------------------------------------------|
      11. | Argentina Brazil 1945 1 |
      12. | Argentina Costa Rica 1945 1 |
      13. | Argentina Guatemala 1945 1 |
      14. | Argentina El Salvador 1945 0 |
      15. | Argentina Ecuador 1945 1 |
      |----------------------------------------------------|
      16. | Argentina Chile 1945 1 |
      17. | Argentina Uruguay 1945 1 |
      18. | Argentina Mexico 1945 1 |
      19. | Argentina Nicaragua 1945 1 |
      20. | Argentina Honduras 1945 1 |
      |----------------------------------------------------|
      21. | Argentina Panama 1945 1 |
      22. | Argentina Bolivia 1945 1 |
      23. | Argentina Peru 1945 1 |
      24. | Bolivia Venezuela 1945 1 |
      25. | Bolivia Dominican Republic 1945 1 |
      |----------------------------------------------------|
      26. | Bolivia United States 1945 1 |
      27. | Bolivia Mexico 1945 1 |
      28. | Bolivia Peru 1945 1 |
      29. | Bolivia Argentina 1945 1 |
      30. | Bolivia Ecuador 1945 1 |
      |----------------------------------------------------|
      31. | Bolivia Haiti 1945 1 |
      32. | Bolivia Guatemala 1945 1 |
      33. | Bolivia Panama 1945 1 |
      34. | Bolivia Nicaragua 1945 1 |
      35. | Bolivia Paraguay 1945 1 |
      |----------------------------------------------------|
      36. | Bolivia Chile 1945 1 |
      37. | Bolivia Uruguay 1945 1 |
      38. | Bolivia Colombia 1945 1 |
      39. | Bolivia Cuba 1945 1 |
      40. | Bolivia El Salvador 1945 0 |
      |----------------------------------------------------|
      41. | Bolivia Costa Rica 1945 1 |
      42. | Bolivia Brazil 1945 1 |
      43. | Bolivia Honduras 1945 1 |
      44. | Brazil Paraguay 1945 1 |
      45. | Brazil Dominican Republic 1945 1 |
      |----------------------------------------------------|
      46. | Brazil Argentina 1945 1 |
      47. | Brazil Panama 1945 1 |
      48. | Brazil Chile 1945 1 |
      49. | Brazil Nicaragua 1945 1 |
      50. | Brazil Colombia 1945 1 |
      +----------------------------------------------------+

      .

      Comment

      Working...
      X