Date: Sun, 18 Jun 2000 16:11:35 -0400
Reply-To: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject: Re: difference between times?
Content-type: text/plain; charset=Windows-1252
* Using the type of entry you give in your email.
DATA LIST LIST /id(F8) Sleetime(TIME5) sampm(A2) waketime(TIME5) wampm(A2).
1 12:00 PM 11:00 AM
2 2:00 AM 10:00 AM
3 4:00 AM 1:00 PM
4 11:30 PM 12:30 PM
5 12:30 AM 12:45 PM
* I assume sleep time of half past midnight is coded as 12:30 AM.
IF sampm='AM' AND (XDATE.HOUR(sleetime)<>12) timebeg=timebeg+12.
IF wampm='PM' AND (XDATE.HOUR(waketime)<>12) timeend=timeend+12.
* Here dur1 is a real number (10.25 means 10 hours 15 minutes)
* if you want answer in HH:MM format.
*To increase speed of entry, I would recommend to enter 0 for AM and 1 for
PM. The above syntax would have to *be changed accordingly. Note that a time
like 12:30 can be entered as 12.30 instead of 12:30. The advantage of *12.30
is that it can be entered using ONLY the numeric pad, it is therefore faster
* method 2 (not really easier or better).
* Here time is entered in DTIME format, in this format.
* 0 21:00 means 9 PM the day before the survey.
* 1 00:30 means half past midnight.
* 1 01:00 means 1 AM the day of the survey.
* 1 12:30 means 12:30 PM the day of the survey.
DATA LIST LIST /id(F8) Sleetime(DTIME8) waketime(DTIME8).
1 1:00:00 1:11:00
2 1:2:00 1:10:00
3 1:4:00 1:1:00
4 0:11:30 1:12:30
5 1:00:30 1:12:45
FORMAT dur3 (TIME5).
*Here dur3 is duration in hours and minutes (10:30 is 10 hours and 30
Raynald Levesque firstname.lastname@example.org
----- Original Message -----
From: James Pratt <jpratt@CYBERZONE.NET>
Sent: Saturday, June 17, 2000 6:09 PM
Subject: difference between times?
> OK, two questions for any date/time calculation gurus out there. I have a
> survey that asks the participant to indicate what time they went to sleep
> last night and what time they woke up this morning. I want to know how
> they slept the night before they filled out the survey.
> I have a few thousand responses that have been entered into SPSS 10 in the
> way the survey is laid out, which is the following:
> Case SleepTime SAMPM WakeTime WAMPM
> 1 12:00 PM 11:00 AM
> 2 2:00 AM 10:00 AM
> 3 4:00 AM 1:00 PM
> 4 11:30 PM 12:30 PM
> SleepTime and WakeTime are in Date format with HH:MM formatting. SAMPM and
> WAMPM are coded 1 for AM, 2 for PM.
> Question 1: Any SPSS syntax (or advice) out there to calculate the time
> differences in this format?
> Question 2: What would be the best format to enter this data for ease of
> calculation, keeping in mind that it is being done via cheap labor (read:
> undergrad assistant)?