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

st: Support for negative time-format (duration)

From   Steinar Fossedal <[email protected]>
To   [email protected]
Subject   st: Support for negative time-format (duration)
Date   Wed, 30 Sep 2009 19:03:09 +0200

Hi, listers

I'm currently working on a dataset where I am interested in examining
the observations' time difference compared to a base time. Thus I have
defined the variable

gen double timediff = observedtime - basetime
format timediff %tcHH:MM:SS

In cases with negative timediff, this format displays the results as
e.g. 23:50:00 (for 10 minutes negative). I would like the results
displayed as -00:10:00, so they can be easily related to the positive
timediffs. Besides improved readability in the dataset, this would
enable me to create a histogram on timediff, showing the spread in
timediff on both the positive and negative side.

I need to work on the timediff as the basetime is different for
different groups in the dataset, so I can't simply make a histogram on
observedtime for all observations.

Any suggestions on how to solve this?

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index