Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: dates


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: dates
Date   Thu, 21 Aug 2003 13:31:52 +0100

Ulrich Kohler
 
> I have two  questions on elapsed dates:
> 
> The mdy()-function returns the elapsed date, counting from 
> January 1 1960.
> 
> . display mdy(1,1,1960)
> 0
> 
> . display mdy(1,2,1960)
> 1
> 
> . display mdy(12,24,100)
> -678993
> 
> However 
> 
> . display mdy(12,24,99)
> 
> returns a missing value, as does
> 
> . display mdy(12,24,00)
> .
> 
> What is the reason that mdy() returns missing with 2 digit 
> years ( to prevent 
> the user from using two digit years?)

Dates in Stata start at 1 January 100. That once put paid 
to a project I wanted to do on modelling of 
daily temperature measurements and olive prices under 
Julius Caesar, but Stata Corp were unyielding: they have 
no interest in changing this limit. 

As you say, elsewhere you can indicate separately a two-digit 
year and a century, so that "52" and "19" can be coupled 
together. It gets a bit awkward to imagine "52" and "0" 
being coupled together to indicate the year 52. 
 
> The second question is just for curiosity. Is there any 
> reason for using the 
> January 1 1960 as zero? It seems quite common in software 
> programs, but why?

Interesting little historical question. I guess some 
data base or spreadsheet program started this as a 
convention, and lots followed. Perhaps there was a 
presumption that nobody much wanted to deal with 
data before that. (Depending upon implementation, 
perhaps you could have dates before as negative numbers, 
as in Stata.)

Also, suppose you used 1 January 1 as a basis. Then 
most daily dates which would be used would be represented 
by integers ~ 700,000 and that could tie up lots of bytes which, 
a few years ago, was of course a much bigger deal. 

As far as Stata is concerned, a more natural base 
would be 21 January 1952 (see [U] p.302), but that 
would be rather too idiosyncratic to fit the bill. 

Nick 
n.j.cox@durham.ac.uk 


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index