Login  Register

Re: Flagging a date that occurs within two date variables

Posted by David Marso on Jun 25, 2013; 6:27pm
URL: http://spssx-discussion.165.s1.nabble.com/Flagging-a-date-that-occurs-within-two-date-variables-tp5720884p5720889.html

I like the RANGE function for such:
COMPUTE DateFlag= RANGE ( DecisionDate , StartDate , EndDate ).

Mags wrote
Hello List

I am struggling with identifying a date within a range of date variables. I
want to know if a specific date - DecisionDate occurs within the date range
defined by client start and end dates. For example, does the decision date,
6/1/2008, for client X fall between his start date of 5/3/2007 and his end
date of 1/2/2009. For this client it would be 1 or yes. If the date does not
fall within that range, the returned valued would be 0 or No. To make this
more confusing, some of the start dates are missing. So, if the start date is
missing I want the returned value to be missing. Thus, the value of the new
variable (DateFlag) could be 1,0 or missing.

I'm trying to write syntax for this expression: if dDate is between Sdate and
EDate, then DateFlag = 1, otherwise 0, Unless Sdate is missing, then
DateFlag=missing.

Thanks for your help.

Mags

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"