Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: add hours to date variable


From   Caleb Southworth <caleb@uoregon.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: add hours to date variable
Date   Sat, 28 Aug 2010 11:40:34 -0700 (PDT)

How can I add hours to a date variable? The hours are in decimal, such that 13:45 = 13.75, etc.

. sum date hour

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        date |       735       18428    70.77298      18306      18550
        hour |       735    12.99728     4.90426          6         19

. desc date hour

              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------------------------------------
date            float  %td
hour            byte   %9.0g


Caleb Southworth
Associate Professor
Univ. of Oregon Sociology
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index