Using example data below, the rangestat(sum) code I have will produce a quantity that sums how many siblings a child had that attended a program in a given year. So for example, in 2002, child_id 301 had both of their siblings attend, so they get a value of 2.
What I can't figure out is that, even when a child has all their siblings missing on binary_attend_SELF in a given year (like 1994 in this example data), the rangestat(sum) produces a 0 when I want it to produce a missing. How can I get it to do this?
What I can't figure out is that, even when a child has all their siblings missing on binary_attend_SELF in a given year (like 1994 in this example data), the rangestat(sum) produces a 0 when I want it to produce a missing. How can I get it to do this?
Code:
clear input child_id mother_id year binary_attend_SELF 301 3 1994 . 301 3 1996 0 301 3 1998 1 301 3 2000 0 301 3 2002 0 301 3 2004 . 301 3 2006 . 301 3 2008 . 301 3 2010 . 302 3 1994 . 302 3 1996 . 302 3 1998 0 302 3 2000 1 302 3 2002 1 302 3 2004 0 302 3 2006 . 302 3 2008 . 302 3 2010 . 303 3 1994 . 303 3 1996 . 303 3 1998 . 303 3 2000 . 303 3 2002 1 303 3 2004 0 303 3 2006 0 303 3 2008 0 303 3 2010 . end rangestat (sum) binary_attend_SIBSUM = binary_attend_SELF, excludeself interval(year 0 0) by(mother_id) list child_id year binary_attend_SIBSUM
Comment