Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: creating variable containing number of children


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: creating variable containing number of children
Date   Thu, 27 Nov 2008 17:43:10 -0000

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index