Announcement

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

  • How do we extend an unbalanced panel to a balanced monthly panel?

    Hi~ I have a question about extending a unbalanced panel into a balanced monthly panel:

    I have a panel data which have a structure looks like the following:
    id starting date ending date monthly wage
    001 19990101 19990115 400
    001 19990116 19990605 800
    001 19990606 19991031 1000
    Different individuals may have different numbers of records. Therefore it's an unbalanced panel.

    I need to construct a balanced monthly panel out of the above information. More precisely, I need a data structure looks like the following:
    id year month monthly wage
    001 1999 1 400+800
    001 1999 2 800
    001 1999 3 800
    001 1999 4 800
    001 1999 5 800
    001 1999 6 800+1000
    001 1999 7 1000
    001 1999 8 1000
    001 1999 9 1000
    001 1999 10 1000
    001 1999 11 0
    001 1999 12 0
    Note that: (1) in month 1 and 6, there are multiple wage records and I need to sum up the wages for these months. (2) For month 11 and 12, there is no records, so the wage is 0.


    I have no idea how to create such a balanced panel with STATA. Could anyone give some advice? Your help is very much appreciated !

  • #2
    Zoey:
    welcome to the list.
    The advice is: don't do it, for two reasons:
    - attrition in your datset might be informative (and you should investigate it first);
    - Stata (not STATA, please) can handle both balanced and unbalanced panel datasets with no problem.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Zoey:
      welcome to the list.
      The advice is: don't do it, for two reasons:
      - attrition in your datset might be informative (and you should investigate it first);
      - Stata (not STATA, please) can handle both balanced and unbalanced panel datasets with no problem.
      Dear Carlo,
      Thank you very much for your timely response and kind reminder!~ It's very much appreciated!
      I think I have to create such a panel because I need to create a plot of wages over months... Is there any Stata command or code to support that?


      Best,

      Comment


      • #4
        Zoey:
        the no-frills code might be:
        Code:
        . use "http://www.stata-press.com/data/r15/nlswork.dta"
        
        . histogram ln_wage, by(year)
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          Zoey:
          the no-frills code might be:
          Code:
          . use "http://www.stata-press.com/data/r15/nlswork.dta"
          
          . histogram ln_wage, by(year)
          Dear Carlo,

          Thank you for your reply~
          Sorry that I did not make my question clear enough~ I mean is there any Stata command or code that might be helpful to extend panel?

          Best,

          Comment


          • #6
            Zoey:
            see -expand-.
            Kind regards,
            Carlo
            (Stata 18.0 SE)

            Comment


            • #7
              Originally posted by Carlo Lazzaro View Post
              Zoey:
              see -expand-.
              Thank you a lot! That's what I'm looking for~

              Best,

              Comment

              Working...
              X