See the FAQ
FAQ . . Creating variables recording prop. of the other members of a
group
4/05 How do I create variables summarizing for each
individual properties of the other members of a
group?
http://www.stata.com/support/faqs/data/members.html
Nick
[email protected]
Florian Wakolbinger
my data contains individuals, the family structure looks like this:
HHID PID Mother Description
1 1 5 Mother
1 2 Father
1 3 1 Child1
1 4 1 Child2
1 5 Grandmother
HHID is the household ID, PID is the personal ID, Mother is the ID of
the observation's mother and description is just to illustrate.
I want to create an additional variable "number of children". This
should be 2 for person 1 (since she has 2 children) and 1 for person 5
(since the mother in the household is the child of the grandmother).
Obviously grouping by HHID does not work since I have 3 generations in
one household.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/