Announcement

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

  • Quarterly Data seen as daily?

    Hello everyone, before coming here I tried solving the issue myself but nothing worked out. I'm not sure if it's the formatting or something else.

    Click image for larger version

Name:	screendata.png
Views:	1
Size:	106.0 KB
ID:	1379729


    I'm trying to do time-series analysis and when I open this excel file my Date variable is seen as daily or what I think it's daily because it %td instead of %tq. Is that how STATA is supposed to work or is it actually a problem?

  • #2
    Originally posted by Josh Hill View Post
    I'm trying to do time-series analysis and when I open this excel file my Date variable is seen as daily or what I think it's daily because it %td instead of %tq. Is that how STATA is supposed to work or is it actually a problem?
    It's not clear whether you're asking an Excel question or a Stata question. I see that each Date values appears as the first day of a quarter in an Excel date format.

    Did you export excel a Stata dataset that has a variable Date containing quarterly data that was formatted %tq? If so, I think that it's how Stata is supposed to work, and I'm guessing that it's because Excel has no corresponding format, and so the first day of the quarter in a date format is about the only thing that Stata can do when converting the quarterly data to something that Excel can display.

    Comment


    • #3
      See http://www.statalist.org/forums/foru...quarterly-data

      Comment


      • #4
        I assume that you have your data in Stata and that your dates are recognised as daily data because you have the day,month and year even if spaced quarterly.
        The following example should show you how to proceed.
        Code:
        input str10 datestring
        "01/01/2000"
        "01/04/2000"
        "01/07/2000"
        "01/10/2000"
        end
        list datestring
        gen date = daily(datestring, "DMY")
        gen dateqtr = qofd(date)
        format dateqtr %tq
        list dateqtr
        Only the third last and second last lines are relevant for you.
        You have a further complication: your year only contains the last two digits and spans 19xx and 20xx. You need to take this into account. I have to leave now and cannot show you how.
        Last edited by Eric de Souza; 23 Mar 2017, 05:18. Reason: Text added at the end

        Comment


        • #5
          Originally posted by Eric de Souza View Post
          I assume that you have your data in Stata and that your dates are recognised as daily data because you have the day,month and year even if spaced quarterly.
          The following example should show you how to proceed.
          Code:
          input str10 datestring
          "01/01/2000"
          "01/04/2000"
          "01/07/2000"
          "01/10/2000"
          end
          list datestring
          gen date = daily(datestring, "DMY")
          gen dateqtr = qofd(date)
          format dateqtr %tq
          list dateqtr
          Only the third last and second last lines are relevant for you.
          You have a further complication: your year only contains the last two digits and spans 19xx and 20xx. You need to take this into account. I have to leave now and cannot show you how.
          Holy smokes, thank you very much. Exactly what I wanted. Another question I may have is, will I have to mention that the newly generated qDate is quarterly when filling in time settings to plot a time-series or will it all be done automatically? Thanks a lot, my Date data looks exactly how I want it to look (basically 1997q1,1997q2 etc..)

          Comment


          • #6
            Try it and see. If tsset or xtset thinks the data are quarterly, it will tell you.

            (Either command is in fact smart enough to look at the display format. If that was wrongly assigned, then you are in trouble, but you seem on the right lines here.)

            Comment

            Working...
            X