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

RE: st: RE: Date + Time of Day


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Date + Time of Day
Date   Wed, 15 Jun 2005 16:03:12 +0100

Absolutely. Remembering to use floor() rather than int() or round(). If you use round() then times after midday will round to the next day. Less obviously, if you use int() then dates before 1960 will be 1 day out as they will round towards zero.

David

-----Original Message-----
From: Eric G. Wruck [mailto:[email protected]]
Sent: 15 June 2005 15:50
To: [email protected]
Subject: Re: st: RE: Date + Time of Day


Ok, I see that StatTransfer did exactly what you describe.  I guess if I want to tabulate transactions by date I'll have to create a separate date field that holds the integer portion of the date -- right?

Thanks,

Eric


>As an alternative to Joseph's ODBC suggestion... If you have StatTransfer, then you can bring the data into Stata with -inputst- and this will bring the date/time field in as a numeric daily date with a fractional part representing the time.
>
>For example 6pm today would be 16602.75
>
>The only problem with this is that Stata has no date/time display format, so with %d display format this would just show "15jun2005".
>
>David
>
>-----Original Message-----
>From: Eric G. Wruck [mailto:[email protected]]
>Sent: 15 June 2005 14:41
>To: [email protected]
>Subject: st: Date + Time of Day
>
>
>I have an Excel spreadsheet which includes a date column & dates are
>in the following form:
>
>11/14/2000  16:27:00
>
>That is, the date includes the time of day.  I've searched my Stata 9
>manuals & all I can find on time is part of c(return) where one can
>use c(current_time) but this doesn't seem relevant/helpful.
>
>Is there a format that includes time as part of a date, or do I have
>to parse this field out & create my own separate time variable?  What
>do others do to handle this?
>
>Thanks,
>
>Eric


-- 

===================================================

       Eric G. Wruck
       Econalytics
       2535 Sherwood Road
       Columbus, OH  43209

       ph:      614.231.5034
       cell:    614.330.8846
       eFax:    614.573.6639
       eMail:   [email protected]
       website: http://www.econalytics.com

====================================================
*
*   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/



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index