Announcement

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

  • Time variable with gaps

    I am trying to use cusum tests but getting errors saying my time variable has gaps. In fact when I do tsset I get the following:

    Time variable: date2, 01jan2016 to 01aug2019, but with gaps
    Delta: 1 day

    When I go to Data editor, however, I can see no gaps in my time variable. Where could this be coming from?

    Thanks!

  • #2
    what does tsreport return?
    Code:
    tsreport, detail

    Comment


    • #3
      I find it odd that your data starts and ends on the first day of a month. Is it the case that you have monthly data, with each month's data reported on the first of the month? Or on the first business day of the month?

      If this is the case, then for your time series analyses to function correctly, you need to use your Stata "daily date" to create a Stata "monthly date" and then use the monthly date in your tsset command.
      Code:
      generate month2 = mofd(date2)
      format %tm month2
      tsset month2
      But please, if this is indeed the solution, don't just take this code and plug it in and move on without understanding why you need to do this.

      Stata's "date and time" variables are complicated and there is a lot to learn. If you have not already read the very detailed Chapter 24 (Working with dates and times) of the Stata User's Guide PDF, do so now. If you have, it's time for a refresher. After that, the help datetime documentation will usually be enough to point the way. You can't remember everything; even the most experienced users end up referring to the help datetime documentation or back to the manual for details. But at least you will get a good understanding of the basics and the underlying principles. An investment of time that will be amply repaid.

      All Stata manuals are included as PDFs in the Stata installation and are accessible from within Stata - for example, through the PDF Documentation section of Stata's Help menu.

      Comment

      Working...
      X