Announcement

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

  • Year Dummies

    Hi,
    I am working with an unbalanced panel dataset consisting of 4 panels of a 4 year duration each (1995-1998, 1996-1999, 1997-2000, 1998-2001) and I observe every person (per panel) for 4 consecutive years. I would like to create year dummies to control for things that might change from one survey year to the next.

    I did:
    gen year1995=0
    replace year1995=1 if yearofsurvey==1995

    gen year1996=0
    replace year1996=1 if yearofsurvey==1996
    .
    .
    .
    .
    gen year2001=0
    replace year2001=1 if yearofsurvey==2001

    My question is firstly whether the way I created the year dummies is correct and secondly whether I also have to create Panel dummies for the 4 different panels I appended together so as to control for things that may differ from one panel to the other or whether the year dummies and the randomness of the individuals chosen into the various panels already control for these.

    Many thanks in advance
    Last edited by christiana; 03 Jul 2014, 02:25.

  • #2
    A variable name cannot begin with a digit in Stata, so something like
    gen 1995=0
    is not valid. In addition, in many (if not most) cases you don't need to construct indicator (dummy) variables yourself, because most estimation commands are able to handle factor variables. Finally, your question about "panel dummies" is really a model specification question, and can't be answered without information about what model you're intending to fit, and what question(s) you're trying to answer.

    Comment


    • #3
      Many thanks for this Phil.
      One clarification in regards to factor variables: instead of generating 7 year dummies would I just put the yearofsurvey variable in my list of independent variables and just put an i. infront and that would work?
      Thanks again

      Comment


      • #4
        As Phil implies you could not have entered the code you give, as the very first line would have produced an error message. Thus your question mixes genuine doubts with points that obscure them.

        Please do study the FAQ Advice at http://www.statalist.org/forums/help, especially Sections 6 and 12, and including the injunction

        Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly! If you can, reproduce the error with one of Stata's provided datasets, a small fragment of your dataset, or a simple concocted dataset that you include in your posting.

        Comment


        • #5
          Originally posted by christiana View Post
          One clarification in regards to factor variables: instead of generating 7 year dummies would I just put the yearofsurvey variable in my list of independent variables and just put an i. infront and that would work?
          In the narrowest sense, the answer to your question is yes. However, I hesitate to say that without qualification, because as I said, whether that results in a sensible model depends entirely on what model you're fitting. For example, each person in your dataset has (up to) 4 observations—are you fitting a model that explicitly accounts for this longitudinal component of the data? What is the research question you're asking?
          Last edited by Phil Schumm; 03 Jul 2014, 02:30.

          Comment


          • #6
            apologies
            #1 edited following your comment

            Comment

            Working...
            X