I am working with a matched case control study, where there are multiple controls (case = 0) matched to one case (case = 1) by the variable "trimgroupid".
Each observation has it's own ID (uniqueid).
What I want to do is identify the controls that have a date of birth (dob) > 1 year away (+ or -) from it's matched case.
Here is what I have:
data have;
infile datalines delimiter=',';
length uniqueid $5 trimgroupid $7;
format dob mmddyy10.;
input uniqueid $ trimgroupid $ dob mmddyy10. case;
datalines;
X0131,XX01491,03/10/2000,1
X1831,XX01491,12/05/2002,0
X3691,XX01491,06/02/2000,0
X1971,XX04997,02/05/2010,1
X2611,XX04997,03/13/2011,0
X4371,XX04997,06/25/2009,0
X4621,XX04997,01/01/2009,0
;
run;
And here is what I want:
data want;
infile datalines delimiter=',';
length uniqueid $5 trimgroupid $7;
format dob mmddyy10.;
input uniqueid $ trimgroupid $ dob mmddyy10. case;
datalines;
X1831,XX01491,12/05/2002,0
X2611,XX04997,03/13/2011,0
X4621,XX04997,01/01/2009,0
;
run;
For the trimgroupid value of XX01491 there is 1 control whose dob is > 1 year away from the case it is matched to.
For the trimgroupid value of XX04997 there are 2 controls whose dob is > 1 year away from the case it is matched to.
... View more