Hi there,
I'm trying to run a pooled cross-sectional regression model by combining yearly datasets from the UK LFS. I have eight datasets, one for each year between 2015 and 2022 inclusive. I'm having some trouble however with getting dummy variables for each year, so that I can control for differences associated with each time period.
As I'm appending each of the datasets, I thought I could use the 'generate' option on the append command to create a variable, 'year', to distinguish between each year. I would then run the regression with i.year as a dependent variable, and introduce my other variables along with it.
However, when I try this, Stata drops two categories - 2022 and 2021. My understanding until now was that to avoid the dummy variable trap, one had to include n-1 dummy variables, where n is the number of categories. However, in this case Stata seems to be dropping two categories - this is a problem because the coefficients on the year dummies are important to my analysis. I've included my code below:
I'm trying to run a pooled cross-sectional regression model by combining yearly datasets from the UK LFS. I have eight datasets, one for each year between 2015 and 2022 inclusive. I'm having some trouble however with getting dummy variables for each year, so that I can control for differences associated with each time period.
As I'm appending each of the datasets, I thought I could use the 'generate' option on the append command to create a variable, 'year', to distinguish between each year. I would then run the regression with i.year as a dependent variable, and introduce my other variables along with it.
However, when I try this, Stata drops two categories - 2022 and 2021. My understanding until now was that to avoid the dummy variable trap, one had to include n-1 dummy variables, where n is the number of categories. However, in this case Stata seems to be dropping two categories - this is a problem because the coefficients on the year dummies are important to my analysis. I've included my code below:
Code:
use 2015.dta append using 2016 2017 2018 2019 2020 2021 2022, generate (year) probit job_found i.year if INCAC051==5
Comment