G
Guest
I have a table with multiple duplicate entries, and need to somehow filter
out dates based on a specific code. Here's an example of one multiple record.
SSN CODE STARTDATE ENDDATE
123 A 01/01/2005 01/31/2005
123 B 03/01/2005 04/30/2005
123 C 04/15/2005 04/20/2005
123 B 04/24/2005 05/15/2005
What I need is this:
IF a SSN has a CODE of C, did that SSN have ANY other CODEs with a STARTDATE
within 5 days of the ENDDATE of the occurence of the C code.
In the case above, the key entry is the third one (IF a SSN has a CODE of
C), THEN did that same SSN have any other CODEs within 5 days (STARTDATE), of
the 'C' CODE ENDDATE.
My guess is that I'd first have to eliminate any non-qualifiers. In the
example above, the first two rows are insiginificant, because the occur
BEFORE the initial 'C' CODE. I am just interested in reoccurrences within 5
days AFTER a 'C' CODE occured.
Anyone who can figure this one out gets a gold star.
out dates based on a specific code. Here's an example of one multiple record.
SSN CODE STARTDATE ENDDATE
123 A 01/01/2005 01/31/2005
123 B 03/01/2005 04/30/2005
123 C 04/15/2005 04/20/2005
123 B 04/24/2005 05/15/2005
What I need is this:
IF a SSN has a CODE of C, did that SSN have ANY other CODEs with a STARTDATE
within 5 days of the ENDDATE of the occurence of the C code.
In the case above, the key entry is the third one (IF a SSN has a CODE of
C), THEN did that same SSN have any other CODEs within 5 days (STARTDATE), of
the 'C' CODE ENDDATE.
My guess is that I'd first have to eliminate any non-qualifiers. In the
example above, the first two rows are insiginificant, because the occur
BEFORE the initial 'C' CODE. I am just interested in reoccurrences within 5
days AFTER a 'C' CODE occured.
Anyone who can figure this one out gets a gold star.