LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 20 Dec 2010 23:28:57 -0500
Reply-To:   Arthur Tabachneck <art297@ROGERS.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@ROGERS.COM>
Subject:   Re: Identify multiple births
Comments:   To: chloegal04@GMAIL.COM

Does the following do what you want?

data have; informat Birth_Child_DOB ddmmyy10.; format Birth_Child_DOB ddmmyy10.; input Birth_Child_DOB Mother_ID @@; cards; 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; run;

%let leeway=10;

data want; set have; format DOB_Lookbehind ddmmyy10.; by Mother_ID; 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) then multiple=1; output; run;

HTH, Art -------- On Tue, 21 Dec 2010 11:07:07 +0800, Chua Lily <chloegal04@GMAIL.COM> wrote:

>Hi, >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 <goladin@gmail.com> wrote: > >> Hi, >> >> 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 <chloegal04@gmail.com> wrote: >> >>> Hi, >>> 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! >>> >> >> >> >> -- >> Regards, >> Murphy Choy >> >> Certified Advanced Programmer for SAS V9 >> Certified Basic Programmer for SAS V9 >> DataShaping Certified SAS Professional >>


Back to: Top of message | Previous page | Main SAS-L page