Many ways to go, but perhaps the easiest to follow is:
egen hhid=group(ent mun numviv numhog)
g kid=age<18
egen nkids=sum(kid), by(hhid)
On 2/22/06, Scott Cunningham <[email protected]> wrote:
> Thanks to those who answered my last question. I have one more now.
> I need to count how many children are in a given household and assign
> this number to each individual in the same household.
>
> I do not have a specific household id, but rather, I can distinguish
> households by first, the state id (ent), then the municipality id
> (mun), then the community id (numviv), and then household number
> (numhog).
>
> Also, can I some how, assign a specific household id number such that
> I do not have to look at the state, the municipality, the community
> and then the household.
*
* 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/