|
Edward
DATA LIST FREE /id (f8.0) date (date10).
BEGIN DATA
1 11-12-2001
1 21-12-2001
1 30-12-2001
2 10-1-2000
2 12-1-2000
2 15-2-2000
2 20-3-2000
2 26-4-2000
END DATA.
AGGREGATE OUTFILE = * /BREAK id /start = MIN(date) /end = MAX(date).
COMPUTE days = (end - start)/ 86400.
FORMAT days (f8.0).
LIST id days.
--jim
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Edward Boadi
Sent: Tuesday, September 12, 2006 8:10 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: calculations between rows solved
Paul, I am interested in knowing (syntax) how that was done.
Regards.
Edward.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Paul Mcgeoghan
Sent: Tuesday, September 12, 2006 6:03 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: calculations between rows solved
Figured it out using Data Aggregate,
I can specify the 1st row and the last row and create a new aggregated
dataset from that where I can then compute the difference between the 2
dates.
Hi,
I have a customer with data as follows:
ID Date
1 11-DEC-2001
1 21-DEC-2001
1 30-DEC-2001
2 10-JAN-2000
2 12-JAN-2000
2 15-FEB-2000
2 20-MAR-2000
2 26-APR-2000
He wants to have:
ID Days
1 19
2 107
What is best way to do this?
Thanks,
Paul
==================
Paul McGeoghan,
Application support specialist (Statistics and Databases), University
Infrastructure Group (UIG), Information Services, Cardiff University.
Tel. 02920 (875035).
|