On 3/1/06, Zamira Simkins <[email protected]> wrote:
> sort hhid
> egen no_kids=count(id) if age<19, by(hhid)
> /*this counts kids in every hh and places the sum in a row where an
> individual is <=18yo, rows with adults will have a missing value because
> they did not meet the if condition*/
> egen no_childr=max(no_kids), by(hhid)
> /*this assigns the total number of children to each individual within the
> same hh*/
> replace no_childr=0 if no_childr==.
> drop no_kids
> /*you do not need no_kids anymore, so drop it*/
>
A further problem with this is that it also assumes that children are
literally that, ie. they are considered to be legally considered as
children.
In the field of human genetics (in which I work), off-spring are
considered, thus you may have a patriarch and matriarch, but be
interested in how many off-spring (ie. children) they have, who may
actually be older than 18.
Pedantic, but sometimes important depending on how you are defining 'children'.
Neil
--
"There is always an easy solution to every...problem - neat,
plausible, and wrong." - H. L. Mencken
Email - [email protected] / [email protected]
Website - http://slack.ser.man.ac.uk/
Blog - http://slack---line.blogspot.com/
Flickr - http://www.flickr.com/photos/slackline/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/