Date: Wed, 12 Mar 2003 16:26:00 +0100
Reply-To: Asesoría Bioestadística
<bioestadistica@eresmas.net>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Asesoría Bioestadística
<bioestadistica@eresmas.net>
Subject: Re: dates help needed!
Content-Type: text/plain; charset=us-ascii
Hi
The year in some values in date1 and/or date2 might actually be 190x,
instead of 200x. This syntax can be helpful (not mine, I don't remember
who sent it to the list some time ago or where I got it)
DATA LIST LIST /datevar (adate).
BEGIN DATA
11/7/1962
12/14/1970
2/3/1989
5/14/1901
8/18/1900
END DATA.
SORT CASES BY datevar(A).
LIST.
* change cutoff date as desired.
DO IF datevar < date.mdy(1,1,1905).
. COMPUTE #da = xdate.mday (datevar).
. COMPUTE #mo = xdate.month(datevar).
. COMPUTE #yr = xdate.year (datevar).
. COMPUTE #yr = #yr+100.
. COMPUTE datevar = date.dmy(#da,#mo,#yr).
END IF.
EXE.
LIST.
HTH
Marta Garcia-Granero
-------------- Original message ---------------
No, this is not a desperate plea from a computer stats nerd for
companionship, I'm using the following syntax to establish elapsed time
between two date variables:
COMPUTE INTERVAL = CTIME.DAYS(date1 - date2).
EXECUTE.
date1 is a past date and date 2 is the same for each case (01/11/03).
It
seems to compute correctly if a case's date1 is 00 or more recent,
however
cases with date1 prior to 00 come up as negative numbers and are
nowhere
near correct. Is my syntax incorrect? (I've used a couple of variations
obtained from the web and seem to come up with similar numbers.) Is this
a
SPSSv.8/Y2K glitch? Are little green men invading my computer?
|