Wednesday, March 01, 2006

Re: st: counting number of children in a household

Yours was not an inappropriate intrusion, and your recommendation to read the original post is a good one--you were able to point out my mistake! I was assuming incorrectly that children would be defined as "age<18" --apparently not the case in Mexico, as is evident on re-reading the original post. So we are both guilty of ignoring the right condition to assign 1 to a dummy variable kid.

I maintain the original solution was the most transparent in form, though Michael Blasnik <> has a faster approach, I think. A solution from first principles that is faster should be preferred IMHO:

. bys ent mun numviv numhog: gen hhid=_n==1 if !mi(ent, mun, numviv, numhog) . replace hhid=sum(hhid) if !mi(ent, mun, numviv, numhog) . bysort hhid: gen n_childr=sum(age<19) . by hhid: replace n_childr=n_childr[_N]

I think I shall not get back to work--it's 1am here.

On 3/1/06, Neil Shephard <> wrote: > I apologise for the inappropriate intrusion on the thread, and shall > remember in the future to read the original posting prior to posting > in the future.

* * For searches and help try: * * *


Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?