Date: Wed, 29 Mar 2000 05:19:47 GMT
Reply-To: N Yiannakoulias <nwy@GPU.SRV.UALBERTA.CA>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: N Yiannakoulias <nwy@GPU.SRV.UALBERTA.CA>
Organization: University of Alberta
Subject: selecting controls...help?
Hi all,
Yet another programming task that has me stumped:
I have two files -a case file and a control pool:
Case file Control file
ID1 DATE1 ID2 DATE2 DATE3
1 1997 1 1994 1995
2 1993 2 1998 1997
3 1995 3 1997 1999
4 1997 4 1999 1999
5 1998 5 1999 1999
6 1993 6 1999 1998
... 7 1998 1999
n=2500 8 1998 1997
...
n=80 000 (randomly ordered)
I need to match 4 controls to each case. A control
is matched to a case if DATE2 and DATE3 are >
DATE1. Once a control is successfully matched
to a case, it is removed from the pool. The resultant
Control file should look like this:
Control file
ID2 DATE2 DATE3 MATCH
1 1994 1995 2
2 1998 1997 2
3 1997 1999 2
4 1999 1999 1
5 1999 1999 1
6 1999 1998 1
7 1998 1999 1
8 1998 1997 2
...
n=10 000 (4 controls for each case)
Any suggestions/hints would greatly appreciated,
N