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 <[email protected]> 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 <[email protected]> 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:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/