clear*
input str24 date
"03/07/06 17:15:00, 000000"
"03/07/06 18:05:00, 000000"
end
split date, generate(datepart) parse(,)
generate double timestamp = clock( datepart1, "DMYhms", 2010)
g minutediff=minutes(timestamp[_n]- timestamp[_n-1])
l
HTH
Martin
_______________________
----- Original Message -----
From: <[email protected]>
To: <[email protected]>
Sent: Friday, January 16, 2009 10:15 PM
Subject: st: date-time help
Hello,
I have Stata 8, and I'm trying to generate a new variable which indicates
the elapsed time (in minutes or seconds) between two events. The variables
I want to substract are stored as str24, and contain both date and time in
the same cell
:
03/07/06 17:15:00, 000000
03/07/06 18:05:00, 000000
I would like to generate a numerical variable which indicates that the
elapsed time between the two events is 50 minutes. How is this possible?
I really appreciate your help,
M
*
* 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/
*
* 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/