Date: Fri, 7 Oct 2005 12:56:21 +0200
Reply-To: Spousta Jan <JSpousta@CSAS.CZ>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Spousta Jan <JSpousta@CSAS.CZ>
Subject: Re: converting three variables into one and get the difference
Content-Type: text/plain; charset="us-ascii"
data list list / cdate (adate11) chour (f2) cqu (f1) edate (adate11)
ehour (f2) equ (f1).
Sep/10/2005 10 3 Sep/11/2005 12 4
Aug/21/2005 18 2 Aug/25/2005 10 3
Aug/01/2005 7 2 Aug/12/2005 10 2
recode cqu equ (1=7.5) (2=22.5)(3=37.5)(4=52.5) into cmin emin.
* mid of the quarter of hours.
* compute times in seconds.
compute ctime = cdate + 60*(cmin + 60 * chour).
compute etime = edate + 60*(emin + 60 * ehour).
form ctime etime (datetime).
* compute the difference.
compute differ = etime - ctime.
form differ (dtime).
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Friday, October 07, 2005 4:32 AM
Subject: converting three variables into one and get the difference
I got a database with date and time in two different pair of variables.
First set for commence date and the other set for ending date.
I want to combine two sets into a single date with hour and minutes and
then get the difference between ending date and commence date.
The following example may explain better,
Commence date Hour Minute End date Hour Minute
Sep 10, 2005 10 3 Sep 11, 2005 12 4
Aug 21,2005 18 2 Aug 25, 2005 10 3
Aug 01,2005 07 2 Aug 12, 2005 10 2
Where Minute is categorizes as four quadrants e.g.1, 2,3,4.
I really want to get the difference in days and hours between end date
and commence date.
Any help is highly appreciated.