LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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"

Hi Mahbub, Try this:

data list list / cdate (adate11) chour (f2) cqu (f1) edate (adate11) ehour (f2) equ (f1). begin data. 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 end data.

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).

exe.

Greetings

Jan

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Mahbub Khandoker Sent: Friday, October 07, 2005 4:32 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: converting three variables into one and get the difference

Hi there, 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. Thanks, Mahbub


Back to: Top of message | Previous page | Main SPSSX-L page