Announcement

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

  • Problems with transforming to a quarterly date variable

    Hello,

    I have a dataset with a date variable that has the following form: 29FEB2016
    I know that the next steps of the code would be something like

    Code:
    format date %td
    gen dateq=qofd(reference_date)
    format dateq %tq
    But i somehow struggle to change the date above into a daily stata format.

    Many thanks in advance!

  • #2
    Once you have converted to a quarterly date variable, you've lost the precise detail of the original daily date. You can't restore it by using any display format any more than if I tell you that my birthday falls in the first quarter of the year you can tell me the exact daily date.

    If you want it both ways, you need to assign the original daily dates as value labels. This won't work if any quarterly date corresponds to two or more different daily dates. labmask from the Stata Journal will do this.

    Otherwise put, the details of your struggle aren't clear without showing a realistic data example and the code you tried.

    Comment

    Working...
    X