Dates and missing elements

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Dates and missing elements

homes
Hi,

I'm trying to subtract two dates which I was able to do easily.  The problem I'm having is that some of the dates might have the year but the month is missing.  This results in a missing date as opposed to subtracting the years.  So I have mm/yyyy and I'm subtracting two values to get length of time.  If one of the dates is 88/2003 it doesn't subtract the years but just outputs a missing value.  How do I program in that 88 means a missing variable and to only then use the years?
Reply | Threaded
Open this post in threaded view
|

Re: Dates and missing elements

mpirritano
Homes,

If I were you I'd divide up the dates like so

Compute day = xdate.date(date_variable).
Compute month = xdate.month(date_variable).
Compute year = xdate.year(date_variable).

Then you can say

If (sysmis(month) = 1) date_difference = year1 -year2. * Just
subtracting numbers here, not dates.

Or

if (sysmis(day) = 1) date_difference = year1 - year2.

You get the idea.

Hth,
matt

Matthew Pirritano, Ph.D.
Research Analyst IV
Medical Services Initiative (MSI)
Orange County Health Care Agency
(714) 568-5648

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
homes
Sent: Thursday, June 17, 2010 12:53 PM
To: [hidden email]
Subject: Dates and missing elements

Hi,

I'm trying to subtract two dates which I was able to do easily.  The
problem
I'm having is that some of the dates might have the year but the month
is
missing.  This results in a missing date as opposed to subtracting the
years.  So I have mm/yyyy and I'm subtracting two values to get length
of
time.  If one of the dates is 88/2003 it doesn't subtract the years but
just
outputs a missing value.  How do I program in that 88 means a missing
variable and to only then use the years?
--
View this message in context:
http://old.nabble.com/Dates-and-missing-elements-tp28918925p28918925.htm
l
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
[hidden email] (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