Elapsed Time Calculation (CORRECTION)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Elapsed Time Calculation (CORRECTION)

Shannon Deike-Sims
Dear Listers,

 

I appreciate the comments and assistance that I have received thus far
and through them realized that I had an error in my original message
below. The message should read:

 

I have reviewed the archives and visited Raynald's www.spsstool.net
<http://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 a colon to separate the hours and minutes and I am not
sure how to change the syntax to fit my data.

 

Sample of my data

ID Departure_Time Arrival_Time

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 to calculate the elapsed time.

 

Shannon Deike-Sims

[hidden email]

 

 

________________________________

From: Shannon Deike-Sims
Sent: Friday, August 04, 2006 11:37 AM
To: '[hidden email]'
Subject: Elapsed Time Calculation

 

Dear Listers,

 

I have reviewed the archives and visited Raynald's www.spsstool.net
<http://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]

 
Reply | Threaded
Open this post in threaded view
|

Re: Elapsed Time Calculation

Richard Ristow
At 06:20 PM 8/4/2006, Shannon Deike-Sims wrote:

>Sample of my data
>
>ID Departure_Time Arrival_Time
>1 20:05 22:40
>2 . .
>3  2:15  6:40
etc.

>I would appreciate any additional help to calculate the elapsed time.

This is quite easy, and I'm really surprised nobody seems to have
answered. Likely enough, I missed a response. However, just in case,
this is tested code; SPSS draft output. I assume your times are in
hours and minutes, and that all elapsed times are shorter than 24
hours. Elapsed time is calculated as an SPSS time variable, and as the
number of minutes. (In the listing, forget the blank case at the
beginning. I left the variable names in as input data, by accident.
I've deleted them from the data I posted.)

DATA LIST LIST
    / ID(F4)
      Departure_Time Arrival_Time (2TIME5).
BEGIN DATA
1 20:05 22:40
2 . .
[etc.]
END DATA.

.  /*-- LIST.

NUMERIC ELAPSED (TIME6)
        /MINUTES (F5).
COMPUTE ELAPSED = Arrival_Time-Departure_Time.
IF     (ELAPSED LT 0)
         ELAPSED = ELAPSED + TIME.HMS(24).
COMPUTE MINUTES = CTIME.MINUTES(ELAPSED).
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |11-AUG-2006 18:20:42       |
|-----------------------------|---------------------------|
   ID Departure_Time Arrival_Time ELAPSED MINUTES

    .          .             .          .      .
    1      20:05         22:40       2:35    155
    2          .             .          .      .
    3       2:15          6:40       4:25    265
    4      19:34         23:05       3:31    211
    5          .         10:05          .      .
    6          .          6:12          .      .
    7      16:10         17:45       1:35     95
    8       7:35         11:57       4:22    262
    9       3:22          7:07       3:45    225
   10      19:47         23:37       3:50    230
   11          .         12:55          .      .
   12      22:00          1:07       3:07    187
   13      18:55         20:25       1:30     90
   14      10:20         13:37       3:17    197
   15      15:20         19:38       4:18    258
   16       9:06         12:27       3:21    201
   17       0:45          2:55       2:10    130
   18      16:30         18:28       1:58    118
   19      13:35         14:05       0:30     30
   20       9:35             .          .      .
   21       5:54          9:18       3:24    204

Number of cases read:  22    Number of cases listed:  22