Date: Wed, 30 Jan 2008 15:49:34 -0600
Reply-To: "Oliver, Richard" <roliver@spss.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Oliver, Richard" <roliver@spss.com>
Subject: Re: date arithmetic
In-Reply-To: A<15186109.post@talk.nabble.com>
Content-Type: text/plain; charset="us-ascii"
Convert them to dates, then use the datediff function. Converting numeric "dates" of the form yyyymmdd to SPSS dates was discussed recently. Here's one way:
compute #day=mod(datevar,100).
compute #year=trunc(datevar/10000).
compute #month=trunc(mod(datevar,10000)/100).
compute newdate=date.mdy(#month, #day, #year).
formats newdate (adate10).
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of jimjohn
Sent: Wednesday, January 30, 2008 11:16 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: date arithmetic
hi guys i have two numeric variables with dates in the following format
yyyymmdd, one of them is always greater than equal to the other
i want to get rid of all my records for which there is less than 8 months
difference between these two variables.
does anyone know how to do this in spss? i know of a datediff function, but
my variable has to be a string for that? is there a way to maybe just
convert them to strings and then use datediff? thanks.
--
View this message in context: http://www.nabble.com/date-arithmetic-tp15186109p15186109.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|