Kelly Johnson wrote:
---
Specifically, can I use the mm/dd/yy hh:mm format? (e.g. 04/04/04 09:15
04/04/04 09:15
04/04/04 09:16
---
You should take a look at the -egenmore- functions. First:
ssc install egenmore
Here is an example using hms(), dhms(), and tod():
clear
set obs 1
generate x = mdy(5,6,1999)
generate date = x
format date %d
egen secs = hms(11 27 15)
egen datetime = dhms(date 11 27 15)
generate str sdate = string(date, "%d")
egen stime = tod(secs)
generate str sdatetime=sdate+" "+stime
list , clean
x date secs datetime sdate stime sdatetime
14370 06may1999 41235 14370.477 06may1999 11:27:15 06may1999 11:27:15
Hope this helps
Svend Juul
________________________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone, work: +45 8942 6090
Phone, home: +45 8693 7796
Fax: +45 8613 1580
E-mail: [email protected]
_________________________________________________________
*
* 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/