Announcement

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

  • Creating a Dummy Variable in Stata for Panel Data

    Hello all,

    I want to create a dummy variable that removes the effects of the financial crisis. I have a panel data set with 29 countries and 11 years from 2006-2017. The independent variables that I have are: Immigration, Emigration, Human Capital and Labour Productivity. My dependent variable is GDP.

    I wish to create a dummy variable that will omit the data collected for 2009. The reason I want to create a dummy variable is because I do not want to drop the data. I want to see the effects that my independent variables have on GDP when 2009 is omitted as the coefficients for my variables might change when I run my regression and by running a regression that somehow does not include 2009's data points I can capture that change. Can someone please advise me on the coding to use to create such a dummy?

    Thank you in advance,
    Mikesh Lukka

  • #2
    You can always do
    gen dum2009=(year==2009)

    However, you can more easily just use an if condition on whatever estimator you're using:

    reg y x if year>2009 & year<.

    Finally, you could run it all in one model by:

    gen dum2009=(year==2009)
    reg y c.x i.year i.dum2009#(c.x)

    Comment


    • #3
      Thank you for your response Phil.

      That has answered my question perfectly. Although, I have run into one problem. I am using a fixed or random effects modelling and using the xtreg y c.x, fe i.year i.dum2009#(c.x) makes all of my explanatory variables insignificant. If I reg without the dummy I just generated they are significant. Is there a way to get around this problem?

      Comment

      Working...
      X