Statalist


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

st: creating variable containing number of children


From   Florian Wakolbinger <wakolbinger@drei-e.at>
To   statalist@hsphsun2.harvard.edu
Subject   st: creating variable containing number of children
Date   Thu, 27 Nov 2008 16:33:14 +0100

Dear users,

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.

Does anybody have an idea how this could be done? Thanks very much for your answers!

best, Florian

--
Dr. Florian Wakolbinger
Amraserstrasse 15
A-6020 Innsbruck
www.drei-e.at

+43 664 638 5993

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index