Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: First date
Nick Cox <firstname.lastname@example.org>
Re: st: First date
Thu, 31 Jan 2013 11:53:43 +0000
Date-times for dates and times around now are in trillions (10^12 or
so) of milliseconds
. di %14.0f clock("02-Sep-2012 10:30:14", "DMYhms")
so something is wrong with your variable -ndate_added-, because the
values you have are far too small.
More generally, what you should be doing is to add
date-time in milliseconds = date in milliseconds + time of day in milliseconds
but I guess what you are doing is adding
date-time in milliseconds = date in some other units + time in milliseconds
which won't work.
Note also that whatever display format you assigned to -ndate_added-
is quite immaterial; it's the numeric values underneath that format
that your calculation uses.
On Thu, Jan 31, 2013 at 11:31 AM, Keniajin Wambui <email@example.com> wrote:
> I am using stataIC 12.1 64bit on windows 7.
> I am calculating the first date the values for a given serial number
> given was entered
> The data example is
> time_done ndate_added serialNumber dfst
> 8:01:50 PM 26-Feb-09 88358 72127954
> 4:56:27 PM 27-Feb-09 88358 61004955
> 12:30:27 PM 25-Mar-09 88358 45044981
> 10:30:14 PM 02-Sep-12 88358 81033238
> I am using the following code but its giving me (12:30:27 PM
> 25-Mar-09 88358) as the first data to be entered but according to
> the data (8:01:50 PM 26-Feb-09 88358) was the first to be
> gen double timefst=clock(time_done, "hms")
> replace timefst=clock(time_done, "hm") if timefst==.
> format timefst %tc
> format ndate_added %tc
> gen dfst=ndate_added + timefst
> egen double fdoadd = min(dfst), by(serialNumber)
> how can I solve the problem
* For searches and help try: