Announcement

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

  • xtset: Panel data with two time variables

    Hello everyone. My panel data has a single panel variable and two time variables, namely, year and month. The data for years is for the period 2000 to 2005. Each of these years has data for 12 months. Kindly advise me on how to use the xtset command in this case.

  • #2
    Create a monthly date variable first with say ym(year, month).

    Comment


    • #3
      Generate a yearmonth/date variable from your year and month variables, and xtset on the panel variable and on this new date variable.

      Comment


      • #4
        And here is the ym() function suggested in #3:

        Code:
        . display ym(2022,12)
        755
        
        . display %tm ym(2022,12)
        2022m12

        Comment


        • #5
          Thank you so much for the prompt help.

          Comment

          Working...
          X