I'm looking for help in optimizing my overly convoluted syntax when it comes to the question in the thread title. I think it'll be simpler to show rather than try to explain what I want to happen with the data I have. Here's the type of data I have:
Code:
clear input byte pid int year byte(age birth child_age_1 child_age_2 child_age_3 child_age_4 child_age_5 child_age_6 child_age_7 child_age_8 child_age_9 child_age_10) float total_number_of_children 1 1995 30 1 . . . . . . . . . . 1 1 1996 31 0 . . . . . . . . . . 1 1 1997 32 2 . . . . . . . . . . 3 1 1998 33 0 . . . . . . . . . . 3 1 1999 34 0 . . . . . . . . . . 3 1 2000 35 0 . . . . . . . . . . 3 1 2001 36 1 . . . . . . . . . . 4 1 2002 37 0 . . . . . . . . . . 4 1 2003 38 0 . . . . . . . . . . 4 1 2004 39 0 . . . . . . . . . . 4 1 2005 40 0 . . . . . . . . . . 4 end
and this is how I want it to look after turning info on births into information on children ages in the appropriate variables and years:
Code:
clear input byte pid int year byte(age birth child_age_1 child_age_2 child_age_3 child_age_4 child_age_5 child_age_6 child_age_7 child_age_8 child_age_9 child_age_10) float total_number_of_children 1 1995 30 1 0 . . . . . . . . . 1 1 1996 31 0 1 . . . . . . . . . 1 1 1997 32 2 2 0 0 . . . . . . . 3 1 1998 33 0 3 1 1 . . . . . . . 3 1 1999 34 0 4 2 2 . . . . . . . 3 1 2000 35 0 5 3 3 . . . . . . . 3 1 2001 36 1 6 4 4 0 . . . . . . 4 1 2002 37 0 7 5 5 1 . . . . . . 4 1 2003 38 0 8 6 6 2 . . . . . . 4 1 2004 39 0 9 7 7 3 . . . . . . 4 1 2005 40 0 10 8 8 4 . . . . . . 4 end
Thank you.
0 Response to Programming problem - computing ages of children per woman in a longitudinal data using data on births.
Post a Comment