Does the following do what you want?
informat Birth_Child_DOB ddmmyy10.;
format Birth_Child_DOB ddmmyy10.;
input Birth_Child_DOB Mother_ID @@;
13/2/1993 7477 3/11/1993 7478 3/1/1993 7479 14/10/1993 7480 21/1/1993
7481 15/5/1993 7499 15/5/1993 7499
proc sort data=have;
by Mother_ID Birth_Child_DOB;
format DOB_Lookbehind ddmmyy10.;
set have ( firstobs = 2 keep = Birth_Child_DOB
rename = (Birth_Child_DOB = DOB_LookAhead) )
have ( obs = 1 drop = _all_);
DOB_Lookbehind = ifn( first.Mother_ID, (.), lag(Birth_Child_DOB) );
DOB_LookAhead = ifn( last.Mother_ID, (.), DOB_LookAhead );
if (not missing(DOB_Lookbehind) and
Birth_Child_DOB-&leeway. le DOB_Lookbehind) or
(not missing(DOB_LookAhead) and
DOB_LookAhead-&leeway. le Birth_Child_DOB)
On Tue, 21 Dec 2010 11:07:07 +0800, Chua Lily <chloegal04@GMAIL.COM> wrote:
>sample data as follows. Multiple births refer to babies delivered at the
>same time, eg twins, triplets.
>Eg ID 7499 gave birth to twins. My objective is to find out the type of
>births - single, twins, triplet etc.
> Birth_Child_DOB Mother_ID
> 13/2/1993 7477 3/11/1993 7478 3/1/1993 7479 14/10/1993 7480 21/1/1993
>7481 15/5/1993 7499 15/5/1993 7499
>On Tue, Dec 21, 2010 at 9:41 AM, Murphy Choy <email@example.com> wrote:
>> I think what you can do is to first sort by mother's ID and DOB.
>> Typically using a retain statement, you can construct a baby ID for each
>> birth by the mother.
>> Using the mother's ID and baby's ID, you can than aggregate the results.
>> As Dan mentioned, please remember to set up a date difference of at least
>> 90 days between birth or whatever is the best!
>> On Tue, Dec 21, 2010 at 9:16 AM, LC <firstname.lastname@example.org> wrote:
>>> I've some got some birth data. I would to identify twins, triplets etc
>>> from the data. I have the mothers' unique identifier and baby date of
>>> birth. Appreciate any inputs. Thanks!
>> Murphy Choy
>> Certified Advanced Programmer for SAS V9
>> Certified Basic Programmer for SAS V9
>> DataShaping Certified SAS Professional