[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: handling times and dates
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
--- 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
In the archives there is a list of user-written
stuff I was aware of when I wrote it.
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.)
> 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: