Announcement

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

  • detect a change in a dummy variable

    Hey everyone!

    I have a question regarding dummy variables.
    I have some panel data over a time period from 1997-2014 on trade between different countries and sectors and would like to find out how many new regional trade agreements (variable: rta) were formed during that time. The variable is 0 if none exists and 1 if a trade agreement is in place.


    I have created a variable called ‘countrypair’ for each unique country combination there exists, which numbers all existing country pairs from 1 to 10,817.
    Ideally, I now would like to have a new dummy variable (e.g. new_rta), which is equal to 1 if a new trade agreement has been formed, i.e. when the dummy variable rta has switched from 0 to 1 for the very first time for this country pair. Otherwise new_rta should be equal to 0.

    Does anyone have a clue which commands could be used to detect such a change in the dummy variable conditional on the countrypair?

    Thanks a lot in advance for any help!!

  • #2
    FAQ http://www.stata.com/support/faqs/da...t-occurrences/

    Our own FAQ Advice mentions looking through the Stata FAQs before posting.

    Comment


    • #3
      Marie.
      welcome to the list.
      I would take a look at -help xttrans-.

      PS: Crossed in the cyberspace with Nick's reply, who covers the issue more comprehensively.
      Last edited by Carlo Lazzaro; 26 Mar 2017, 08:52.
      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Thanks a lot for your quick and helpful replies! The next time I will check the FAQ more thoroughly!

        Last edited by Marie Christin; 27 Mar 2017, 03:21.

        Comment

        Working...
        X