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

st: elasped time

From   baum <>
To   StataList <>
Subject   st: elasped time
Date   Tue, 01 Oct 2002 10:29:07 -0400

To follow up on my earlier posting, two additional convenience functions are now available from Nick Cox' egenmore. Both are for presentation of time data.

egen function elap(time) displays the human-readable time associated with a time interval, in days:hours:minutes:seconds. The time variable might be derived from those generated by the dhms() function.

egen function elap2(time1 time2) displays the human-readable time associated with the interval time1 to time2, which must be non-negative, in days:hours:minutes:seconds.

The convenience provided by these functions is decidedly less than the ability to apply such a format to a variable measuring elapsed time: that is, to convert a time interval of 15432.2501 into 432:06:00:08 for display. That would require changes to -format-, which is a built-in command. StataCorp programmers will have to decide whether time intervals should be represented in terms of fractional Stata dates (as these routines do), or as seconds since the beginning of Stata time (as does SAS in its timestamps, or does *nix with a zero date one decade later). Given maintenance of appropriate precision, the choice of units is immaterial. Of course, the number of seconds since 01-jan-1960 will overflow a 32-bit long int around 2028, but by that time Stata version 14 will be running on virtual nanocomputers with 256-bit word length anyway...or will those of us still extant just think of what we want done with the data?

ssc install egenmore, replace will get the new functions.

Christopher F Baum, Boston College Economics, Chestnut Hill MA 02467 USA
* For searches and help try:

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