I'm creating a data set of mothers who have given birth at least 2 times during the study period, with summary statistics to be reported for births at time 1 and time 2. I created a variable birth_num that indicates the chronological number of each birth for the same woman during the study period. For example: MOTHER_ID BIRTH_YR birth_num 5 2009 1 7 2004 1 10 2005 1 10 2008 2 10 2010 3 12 2006 1 12 2008 2 14 2004 1 14 2006 2 14 2008 3 I'm finding that as I apply the exclusion criteria to get the sample (only keep records with valid values for first birth, infant health outcomes, prenatal care, mother's race/ethnicity and immigrant status, and women who have given birth at least 2 times), I'm losing either the birth record at time 1 or time 2 for some MOTHER_IDs. For example, if the record for MOTHER_ID=10 where birth_num=2 is excluded, I'm unable to include this record in the summary statistics for births at time 2. However, the record for MOTHER_ID=10 where birth_num=1 is retained and included in summary statistics for births at time 1. Data after exclusion criteria applied: MOTHER_ID BIRTH_YR birth_num 10 2005 1 10 2010 3 12 2006 1 12 2008 2 14 2004 1 14 2006 2 14 2008 3 How can I only retain birth records that meet selection criteria for births at time 1 and time 2? These are the records I am interested in keeping for summary statistics: MOTHER_ID BIRTH_YR birth_num 12 2006 1 12 2008 2 14 2004 1 14 2006 2 Thank you, Stephanie
... View more