Announcement

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

  • (Unbalanced) Panel data sample for an event study analysis

    Hi everyone

    I'm currently working on a project, where my analysis will consist of an event study.

    I have a dataset where individuals are observed over af 18 years period, but every individual is not necessarily observed in each year.

    Essentially, I want to construct a sample where each individual is observed five years prior to the event (eventtime = 0) and 10 years after. But in order to avoid that the sample gets too small, I want to keep individuals who are observed at least 8 times over the 15-years period, and at least 1 time before the event and 1 time after.

    For now, I have an event-time variable, which have values from -17 to +17 where the value "eventtime=0" is the year the event of interest happens.

    Is there anyone who has a suggestion for a code, that can create the sample with the above-mentioned criteria?

    Thank you in advanced.

  • #2
    Hi Laura,

    I’m sure that there are some on the list that will have some ideas for you but most who frequent here prefer to offer specific solutions. So, without you posting a snippet of your data (using dataex), you’re less likely to get the kind of help that will be helpful.

    Comment


    • #3
      Originally posted by Lance Erickson View Post
      Hi Laura,

      I’m sure that there are some on the list that will have some ideas for you but most who frequent here prefer to offer specific solutions. So, without you posting a snippet of your data (using dataex), you’re less likely to get the kind of help that will be helpful.
      Hi Lance
      Thank you so much for your reply - I'll try posting an example of my data

      Comment


      • #4
        Originally posted by Laura Hoeybye View Post
        Hi everyone

        I'm currently working on a project, where my analysis will consist of an event study.

        I have a dataset where individuals are observed over af 18 years period, but every individual is not necessarily observed in each year.

        Essentially, I want to construct a sample where each individual is observed five years prior to the event (eventtime = 0) and 10 years after. But in order to avoid that the sample gets too small, I want to keep individuals who are observed at least 8 times over the 15-years period, and at least 1 time before the event and 1 time after.

        For now, I have an event-time variable, which have values from -17 to +17 where the value "eventtime=0" is the year the event of interest happens.

        Is there anyone who has a suggestion for a code, that can create the sample with the above-mentioned criteria?

        Thank you in advanced.
        Here is a an example of my data.

        Each individual has and id, and the outcome variable is savings - so I would like to see how savings is effected by the event, at "eventtime=0"

        input long id float(savings eventtime)
        6872 -7 -10
        6872 -9 -9
        6872 -7 -8
        6872 1560 -7
        6872 1560 -6
        6872 -9 -5
        6872 -7 -4
        6872 -7 -3
        6872 -7 -2
        6872 -7 -1
        6872 -7 0
        5804 -7 -8
        5804 -8 -7
        5804 -8 -6
        5804 -7 -5
        5804 -8 -4
        5804 0 -3
        5804 1500 -2
        5804 1500 -1
        5804 1501.1548 0
        5804 -8 2
        5804 -8 4
        5804 -7 7
        0366 -8 -2
        0366 0 -1
        0366 0 0
        0366 0 1
        0366 0 2
        0366 0 3
        0366 0 4
        0366 0 5
        0366 0 7
        0366 0 8
        0366 0 9
        0366 0 10
        0366 -8 11
        0404 -8 -4
        0404 0 -3
        0404 600.4619 -2
        0404 0 0
        0404 0 1
        0404 0 2
        0404 833.3333 3
        0404 0 4
        8243 908.7532 -8
        8243 909.6998 -7
        8243 948.7298 -6
        8243 1200.9238 -5
        8243 1280.9854 -4
        8243 1351.0393 -3
        8243 1383.3334 -2
        8243 1501.1548 -1
        8243 1000.7698 1
        8243 1273.7327 2
        8243 -7 3
        8243 -7 4
        8243 1701.3087 5
        8243 -7 6
        8243 -7 7
        8243 -7 8
        8243 -7 9
        8278 260 -13
        8278 0 -12
        8278 0 -11
        8278 866.6667 -10
        8278 1036.4968 -9
        8278 -7 -8
        8278 1333.3334 -7
        8278 1301.0007 -6
        8278 -7 1
        8278 -7 2
        8257 -8 -3
        8257 -8 -2
        8257 -8 -1
        8257 -8 0
        8257 -8 1
        8257 -8 2
        8257 -8 3
        8257 -8 4
        8257 -8 5
        8257 -8 6
        8257 -8 7
        8257 -8 8
        8257 -8 9
        8257 -8 10
        8257 -8 11
        8257 -8 12
        8257 -8 13
        8257 -8 14
        1606 1400 -1
        1606 0 0
        1606 0 1
        1606 0 2
        1606 0 3
        1606 0 4
        1606 0 5
        1606 0 6
        1606 -8 7
        1649 1872.4404 -1
        1649 2058.5835 0

        Comment

        Working...
        X