Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Variable's value changing

    Hi,

    I have a panel dataset with variables id, t (year), and the number of children between 0-3 y.o. present in the household. So if an individual gives birth, I can see that the variable number of children between 0-3 y.o. becomes 1 for 4 consecutive years.
    Based on this data, I would like to code the years in which each individual gives birth (first_birth, second_birth, etc)
    The data looks like this
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(id t num_children_0_3)
    1 2000 0
    1 2001 1
    1 2002 1
    1 2003 1
    1 2004 1
    1 2005 0
    1 2006 0
    1 2007 1
    1 2008 1
    2 1995 1
    2 1996 1
    2 1997 2
    2 1998 2
    2 1999 1
    2 2000 1
    2 2001 0
    3 2002 0
    3 2003 0
    3 2004 0
    3 2005 1
    3 2006 1
    3 2007 1
    3 2008 1
    3 2009 0
    3 2010 0
    3 2011 0
    3 2012 0
    end
    How can I code it in a way that it shows that for individual one, first_birth=2001 and second_birth=2007 and for individual 2, first_birth=1995 and second_birth=1997?

    Thanks

  • #2
    I don't think you can do that with this data. Inspecting your data, I see that your variable num_children_0_3 means exactly what it says: it is the total number of children between ages 0 and 3 in the household in the year of that observation. And it is clear from several instances where it decreases from one year to the next, that as children turn 4 they "age out" of that category and the value of num_children_0_3 goes down. So if a woman gives birth to a child in the same year that one of her pre-existing children turns 4 years old, the increase from the new child will be cancelled out by the decrease from the new four-year-old, with the result that num_children_0_3 does not change at all that year. So you will not be able to detect that birth in this data. The same thing can happen if one of her 0-3 year old children dies in the same year she gives birth.

    Also, if a woman starts out with num_children_0_3 = 1 in the firest year of her data (as, for example, id 2 does), there is no way to know if this is a pre-existing child or represents her first birth.
    Last edited by Clyde Schechter; 02 Jun 2022, 11:48.

    Comment

    Working...
    X