Re: Flagging a date that occurs within two date variables
Posted by
Jim Marks on
Jun 25, 2013; 3:03pm
URL: http://spssx-discussion.165.s1.nabble.com/Flagging-a-date-that-occurs-within-two-date-variables-tp5720884p5720885.html
here is one solution:
NEW FILE.
DATA LIST LIST / id (f8.0) st_date d_date
end_date (3adate10).
BEGIN DATA
1 , 05/03/2007 , 09/22/2007 , 01/06/2008
2 , 02/03/2009 , 09/22/2011 , 01/06/2010
3 , , 04/29/2009 , 08/11/2011
END DATA.
LIST.
COMPUTE good_decision = d_date GE st_date
and d_date LT end_date.
FREQUENCIES good_decision.
Jim Marks
Sr Market Research Manager
National Market Research
Kaiser Foundation Health Plan of the Mid-Atlantic States, Inc.
2101 E. Jefferson St.
Rockville, MD 20852
Phone: (301) 816-6822
Cell Phone: (301) 456-6164
NOTICE TO RECIPIENT:
If you are not the intended recipient of this e-mail, you are prohibited
from sharing, copying, or otherwise using or disclosing its contents. If
you have received this e-mail in error, please notify the sender immediately
by reply e-mail and permanently delete this e-mail and any attachments
without reading, forwarding or saving them. Thank you.
From:
Mags <[hidden email]>
To:
[hidden email]
Date:
06/25/2013 10:28 AM
Subject:
Flagging a date
that occurs within two date variables
Sent by:
"SPSSX(r)
Discussion" <[hidden email]>
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