# Elapsed Time Calculation

4 messages
Open this post in threaded view
|

## Elapsed Time Calculation

 Dear Listers,   I have reviewed the archives and visited Raynald's www.spsstool.net  website to find elapsed time syntax. I did find the syntax from (http://www.spsstools.net/Syntax/DatesTime/CaculateNumberOfMinutes.txt) to be helpful and almost what I need. The format of my data is different in that it has the semicolon in the time and I am not sure how to change the syntax to fit my data.   Sample of my data   1 20:05 22:40 2 . . 3  2:15  6:40 4 19:34 23:05 5 . 10:05 6 .  6:12 7 16:10 17:45 8  7:35 11:57 9  3:22  7:07 10 19:47 23:37 11 . 12:55 12 22:00  1:07 13 18:55 20:25 14 10:20 13:37 15 15:20 19:38 16  9:06 12:27 17  0:45  2:55 18 16:30 18:28 19 13:35 14:05 20  9:35 . 21  5:54  9:18   I would appreciate any additional help on the elapsed time calculation.   Shannon Deike-Sims [hidden email]
Open this post in threaded view
|

## Re: Elapsed Time Calculation

 Try this: Suppose t1 and t2 are the original VARIABLES : STRING st1 st2 (A6). COMPUTE st1=REPLACE(t1,":",""). COMPUTE st2=REPLACE(t2,":",""). COMPUTE time1=number(st1,f6.0). COMPUTE time2=number(st2,f6.0). EXECUTE. Sample Data  t1          t2 16:10           10:20 7:35            15:20 3:22            1:20  Output. t1       t2       st1    st2       time1    time2 16:10    10:20    1610   1020    1610.00  1020.00 7:35     15:20    735    1520     735.00  1520.00 3:22     1:20     322    120      322.00   120.00 There could be a simpler way of doing this . Regards. Edward -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Shannon Deike-Sims Sent: Friday, August 04, 2006 3:37 PM To: [hidden email] Subject: Elapsed Time Calculation Dear Listers, I have reviewed the archives and visited Raynald's www.spsstool.net  website to find elapsed time syntax. I did find the syntax from (http://www.spsstools.net/Syntax/DatesTime/CaculateNumberOfMinutes.txt) to be helpful and almost what I need. The format of my data is different in that it has the semicolon in the time and I am not sure how to change the syntax to fit my data. Sample of my data 1 20:05 22:40 2 . . 3  2:15  6:40 4 19:34 23:05 5 . 10:05 6 .  6:12 7 16:10 17:45 8  7:35 11:57 9  3:22  7:07 10 19:47 23:37 11 . 12:55 12 22:00  1:07 13 18:55 20:25 14 10:20 13:37 15 15:20 19:38 16  9:06 12:27 17  0:45  2:55 18 16:30 18:28 19 13:35 14:05 20  9:35 . 21  5:54  9:18 I would appreciate any additional help on the elapsed time calculation. Shannon Deike-Sims [hidden email]