Announcement

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

  • Using date() function for dates in First Century AD

    Hello, I have a dataset of events, some of which occurred in the First Century AD. I am having trouble converting these dates with 2 digit years to Stata date format. Here is an example of my issue. As you can see, Stata successfully converts the three digit and four digit years, but has trouble with a two digit year, and converts it to missing. Does anyone have a solution to this issue?

    Code:
    . display %td date("0062-09-23", "YMD")
            .
    
    . display %td date("0162-09-23", "YMD")
    23sep0162
    
    . display %td date("1162-09-23", "YMD")
    23sep1162

  • #2
    Do you really have daily data from the period AD 1 to AD 100? From -help td()-, you have


    td(l)
    Description: convenience function to make typing dates in expressions easier

    For example, typing td(2jan1960) is equivalent to typing 1.
    Domain l: date literal strings 01jan0100 to 31dec9999
    Range: %td dates 01jan0100 to 31dec9999 (integers -679,350 to 2,936,549)

    I guess that you can compute the values 01jan0000 - 31dec0099, taking into account leap years and all that - where 31dec0099 is -679,351 - and then label these values.

    Comment


    • #3
      Thank you! This is very helpful. I hadn't realized that the domains of the date functions meant that one couldn't work with years earlier than 100AD. I will try to develop a hack to work around this issue. I appreciate the insight.

      Comment


      • #4
        Be certain that your dates from before the introduction of the Gregorian calendar in the relevant location are given using the Proleptic Gregorian Calendar rather than in the Julian calendar. Wikipedia tells us, for example, that Shakespeare and Cervantes seemingly died on exactly the same date (23 April 1616), but Cervantes predeceased Shakespeare by ten days in real time (as Spain used the Gregorian calendar, but Britain used the Julian calendar). Or more amusingly, William III of England set sail from the Netherlands on 11 November 1688 (Gregorian calendar) and arrived at Brixham in England on 5 November 1688 (Julian calendar).

        https://en.wikipedia.org/wiki/Gregorian_calendar
        https://en.wikipedia.org/wiki/Julian_calendar
        https://en.wikipedia.org/wiki/Prolep...orian_calendar



        Comment

        Working...
        X