Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Help with data management


From   "[email protected]" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: RE: Help with data management
Date   Thu, 17 Jul 2008 07:13:23 -0700

As a footnote to this:

Katia's error message on trying to use a function -hms()- indicated to me that she was trying to use an -egen- function with -generate-.

She could have been trying to use a Stata 10 function -hms()- within an earlier version of Stata. (Else why did she get an error message?)

In Stata 10, users should note that the official function -hms()- differs from the user-written -egen- function -hms()-, and not just in so far as you can use the latter only with -egen-.

In Stata 10 you can do this, if you have installed -egenmore- from SSC:

. set obs 1
obs was 0, now 1

. gen seven = 7

. gen thirty = 30

. gen fifty = 50

. egen hms_egen = hms(seven thirty fifty)

. gen double hms_gen = hms(seven, thirty, fifty)

. l

     +----------------------------------------------+
     | seven   thirty   fifty   hms_egen    hms_gen |
     |----------------------------------------------|
  1. |     7       30      50      27050   27050000 |
     +----------------------------------------------+

The result of -egen, hms()- is in seconds. The result of the function -hms()- is in milliseconds.




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