Announcement

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

  • Year and Month fixed effects

    Hi,

    I would like to run a regression with year month fixed effects. My data consists of year and months but I am unsure how I should include this dummies.

    If I want to create a dummy for just one month I would use the "gen dj1=1 if month==1" formula, which is the dummy variable for January. But, how am I suppose to do this for both year and month fixed effects?

    Thanks in advance!


  • #2
    Anders:
    welcome to this forum.
    The best way to create categorical variables (and interactions) in Stata is via -fvvarlist-.
    That said, it is pretty rare to see regression that include both -i.year- and -i.month- among predictors.
    As wisely reminded by FAQ, your chances of getting (more) helpful replies are conditional on posting what you typed and what Stata gave you back (via CODE delimiters, please - see FAQ again) and/or sharing an example/excerpt of your data via -dataex- (as per FAQ once more).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X