Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Difference in dates

From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Difference in dates
Date   Sun, 15 Jul 2012 21:44:58 +0100

Evidently if the dates are really the same, the result of calculating
the difference should be 0.

So this question is immediately bounced back to you: what are your
grounds for your contradictory statement? What makes you say these two

Note that either or both being assigned a daily date format is purely
a cosmetic matter, as that just affects what is displayed, and is only
indirectly related to what the value _is_, meaning _is stored as_.
Otherwise put, non-integers will display as if they were (integer)
dates if assigned a daily date format.

. di %td mdy(7,15,2012) + 0.5

. di %td mdy(7,15,2012) + 0.6

. di %td mdy(7,15,2012) + 0.9

. di %td mdy(7,15,2012) + 1

You should look at the date variables using a non-date display format.
Presumably at least one has been calculated incorrectly at some
previous point.


On Sun, Jul 15, 2012 at 8:48 PM, Lisa Davis <[email protected]> wrote:

> I'm comparing two date variables (coded daily) in Stata by subtracting one from a second, which gives a difference in days. When the dates are the same, the result is 0.5 rather than 0. Does anyone have an explanation?
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index