Announcement

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

  • Is this a bug?

    I have Stata SE 15.1 and I noticed Stata does not convert 2/29/2011 to a date value. When I run:

    Code:
    scalar x1=mdy(2,28,2011)
    scalar x2=mdy(2,29,2011)
    dis  x1 ", " x2
    It returns18686 for 2/28/2011 and a missing value for 2/29/2011. Anyone else has this problem?




  • #2
    Try

    Code:
    scalar x1=mdy(2,28,2011)
    scalar x2=mdy(2,29,2011)
    dis %td x1 ", " %td x2
    display, if not explicitly told otherwise, uses a "smart" format to show values; specifying %td prevents this.

    There was no 2/29/2011, hence Stata displays a missing value. There was a 2/29/2012, 2/29/2016, and there will be a 2/29/2020; there is nothing that Stata can do about this.

    Best
    Daniel
    Last edited by daniel klein; 29 Apr 2019, 11:41.

    Comment


    • #3
      As daniel klein implies, it's a feature. Stata knows about leap years for recent and future dates likely to be of use or interest to most users.

      Comment


      • #4
        Thanks. Weird enough I'm working with an organization's personnel data that shows 4 people were fired on 2/29/2011. I should doubt the accuracy of my data!

        Comment

        Working...
        X