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

st: RE: handling times and dates


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: handling times and dates
Date   Tue, 30 Aug 2005 22:19:52 +0100

The short answers are that 

(a) Stata has no inbuilt automatic way to handle 
time of day. 

(b) You need a combined variable 
daily date + fraction of day. 

The explanations for that probably include

--- begin speculation mode; little factual substance 

1. StataCorp have yet to get round to it. 

2. They are not clear what a widely applicable 
system would be. (It's not obvious that
e.g. finance, medical and climate people 
would agree on the conventions to follow.) 
This is not so much a question of what text
users want showing on the outside -- 
although across countries and disciplines 
there are several different practices -- but of 
what data structures and precisions they use. 
There are some good reasons for holding 
time of day as a string, not least because 
Stata offers no formats to represent time 
of day, as you surmise. 

3. There are enough user-written fudges
to hold the users at bay for the time 
being. 

--- end speculation mode 

On the whole, however, I guess that this is less of 
a problem than I guess you may guess it to be. 

There is an FAQ 

http://www.stata.com/support/faqs/graphics/nicetime.html

In the archives there is a list of user-written 
stuff I was aware of when I wrote it. 

http://www.stata.com/statalist/archive/2003-01/msg00592.html

This is dated January 2003, but I don't think 
much has happened since. 

The "user-written" stuff includes some programs
by Dr William Gould, President of StataCorp. That's 
because they are not part of official Stata, and 
because he's a user too. 

(Svend Juul has already drawn attention to -egenmore-, 
which is a home for any deserving user-written -egen- 
functions so long as they satisfy some capricious criteria 
for entry. A good project would be to translate some
of the better ones into Mata functions.) 

Nick 
[email protected] 

Larry deKoning
 
> I am trying to format dates and times so I can graph chunks 
> of a large dataset using twoway line. I have the following 
> variables to consider: date, time, V_max.
> 
> I want to graph V_max on the Y axis, with Time on the X axis, 
> ideally grouped under Date.
> 
> The variable Time in my db is formatted as: "4:07:00 PM", 
> with observations taken every minute. Stata incorrectly 
> recognizes this as a date format. There seems to be no built 
> in format to handle this type of data correctly.
> 
> The format for Date is "10/11/2004" - which is formatted 
> correctly on input.
> 
> Is there any way Stata can 
> (1) handle the time variable in a way that I can graph AND process
> (2) include date on the X axis (as well as time) automatically
> 

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