Statalist


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

st: RE: Support for negative time-format (duration)


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Support for negative time-format (duration)
Date   Wed, 30 Sep 2009 18:13:16 +0100

For listing I think you need StataCorp to come up with a new display format, or to do it yourself by creating a string variable that displays as you wish. 

Nick 
[email protected] 

Steinar Fossedal

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.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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