Statalist The Stata Listserver

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

Re: st: installing hmm, minutes

From   "Austin Nichols" <>
Subject   Re: st: installing hmm, minutes
Date   Wed, 7 Mar 2007 16:39:30 -0500

Jacob Wegelin --
-help egenmore- clearly indicates that the command is -egen- not -gen-
and less clearly that hmm() does not operate on string variables. But
-h strfun- has all you need.

input str5 ps
gen h=substr(ps,1,index(ps,":")-1)
gen m=substr(ps,index(ps,":")+1,.)
gen elapmin=real(h)*60+real(m)
li, noo clean

      ps    h    m    em
    9:32    9   32   572
   12:01   12   01   721

On 3/7/07, Jacob Wegelin <> wrote:
I am trying to convert a string variable that takes on values such as
(i.e., sometimes it contains 3 and sometimes 4 digits)
into a numeric variable representing the time of day.  It appears that
the minutes() function would do this.

What does one have to do to obtain the hmm() and minutes() functions?  Per I installed
egenmore but this does not seem to do the trick. (I have Stata 9.2 on a
. gen junk=hmm(prs1)
Unknown function hmm()
*   For searches and help try:

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