Statalist The Stata Listserver


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

RE: st: installing hmm, minutes


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: installing hmm, minutes
Date   Wed, 7 Mar 2007 21:44:16 -0000

Alternatively, check out -ntimeofday- and -stimeofday- from
SJ 6-1. 

Nick 
n.j.cox@durham.ac.uk 

Austin Nichols
 
> 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.
> 
> clear
> input str5 ps
>  "9:32"
>  "12:01"
> end
> 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 <jawegelin@ucdavis.edu> wrote:
> > I am trying to convert a string variable that takes on 
> values such as
> > 9:32
> > 12:01
> > (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
> > 
http://www.stata.com/statalist/archive/2003-01/msg00592.html I installed
> egenmore but this does not seem to do the trick. (I have Stata 9.2 on a
> PC.)
> . gen junk=hmm(prs1)
> Unknown function hmm()
> r(133);

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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