Announcement

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

  • create a dummy pair of countries

    Hi,

    how can I create a dummy variable for each Partner if my observations are pairs of countries like this:

    Exporter Importer Year Trade
    Country Partern 1 1990 Valor
    Country Partner 2 1990 Valor
    Partner 1 Country 1990 Valor
    Partner 2 Country 1990 Valor
    Country Partner 1 1991 Valor
    thanks!










  • #2
    Daniel:
    see -group- function under -egen-.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thanks Carlo, I know how to create a dummy for each pair of countries.
      But I would like to create a dummy for each partner:

      dummy for Partner 1, dummy for Partner 2.....

      Comment


      • #4
        Daniel:
        is what follows on target?
        Code:
        . set obs 3
        number of observations (_N) was 0, now 3
        
        . g Partner="Partner1" in 1
        (2 missing values generated)
        
        . replace Partner="Partner2" in 2
        (1 real change made)
        
        . replace Partner="Partner3" in 3
        (1 real change made)
        
        . tab Partner, g(Partner_dummy)
        
            Partner |      Freq.     Percent        Cum.
        ------------+-----------------------------------
           Partner1 |          1       33.33       33.33
           Partner2 |          1       33.33       66.67
           Partner3 |          1       33.33      100.00
        ------------+-----------------------------------
              Total |          3      100.00
        
        . list
        
             +-------------------------------------------+
             |  Partner   Partne~1   Partne~2   Partne~3 |
             |-------------------------------------------|
          1. | Partner1          1          0          0 |
          2. | Partner2          0          1          0 |
          3. | Partner3          0          0          1 |
             +-------------------------------------------+
        
        .
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          yes, thanks.

          so it means that I have to do that for each Partner, one by one?

          I have more than a hundred Partners.

          Comment


          • #6
            To get better advice, I think you need to follow our advice.

            Why do you want all these dummies any way? That's >100 new variables on one version of this question.

            The data example in #1 is schematic and doesn't follow our guidelines to use dataex. Usually real concrete examples beat simplified abstract examples. Is there just one Country somehow and is every other state a Partner?

            Does Freedonia as exporter count the same as Freedonia as importer?

            Comment


            • #7
              Ok, Nick Cox.


              I am trying to estimate the impact of Regional Trade Agreements (RTA) on "COUNTRY A" trade using a gravity model.

              My depended variable is the trade of "COUNTRY A" with around 100 countries between 1984 and 2015 (intervals of 4 years).
              Exports from COUNTRY A to country J being one observation, and exports from country J to COUNTRY A, another one.

              I would like to control multilateral resistance terms using exporter-time and importer-time fixed effects. However, I am not sure about how should I used them given that my depended variable is just trade of COUNTRY A.

              I think I have to create a dummy for each country J (Partner), but I am not sure how to do it.

              Comment


              • #8
                I don’t understand this enough to add further advice. You may need to start a new thread using key phrases such as trade and gravity model. If you do that, add a cross-reference to that thread here, and vice versa.

                Comment


                • #9
                  Ok, Thanks Nick. I will try to follow your advice

                  Comment

                  Working...
                  X