Announcement

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

  • Solution to STATA not recognising week 53 in panel data

    Dear all,

    I have a panel dataset where I have weekly data for several European countries. My date variable is "Weeknumber" and portrays week 11 of 2020 as: 2020, 11
    My country variable is named Country and is a string variable portraying the countries name.

    Example of my dataset:
    Country Weeknumber Variable X Variable Z
    Netherlands 2020, 11 (value) (value)
    Netherlands 2020, 12 (value) (value)
    etc. etc. etc. etc.
    How I declared my dataset to be panel data in my do-file:
    // set time
    gen sweek = weekly(Weeknumber, "YW")
    format sweek %tw
    encode Country, gen(scountry)
    xtset scountry sweek

    What is unfortunate, is that my time-range contains a Week 53. Stata doesn't recognise this week and leaves it blank.

    I have looked up a million ways to solve this problem, however I have not managed to do it myself.

    Any help is appreciated!

  • #2
    Please watch this. Then post back your query, formatted using dataex.

    Comment


    • #3
      Iris, you may refer to Nick Cox's advice at https://www.statalist.org/forums/for...ates-year-week (#9 and #14).

      Comment

      Working...
      X