| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: genealogy: how to calculate sibship size
Ronnie Babigumira already directed you to an FAQ explaining various
tricks. It may be more complicated than you need.
I just wanted to add that if each observation is a person and your
variables are as stated then the number of people sharing each pair of
parents is given directly by
bysort ??ther_id : gen n = _N
Thus suppose that our data are
donor_id father_id mother_id
1 A Z
2 A Z
3 A Y
4 A Y
5 B Y
6 C X
then after this
bysort ??ther_id : gen n = _N
you have
donor_id father_id mother_id
1 A Z 2
2 A Z 2
3 A Y 2
4 A Y 2
5 B Y 1
6 C X 1
Note that you don't need a combined id, as you can just
use the two parent ids jointly.
(I enjoyed using the wildcard ??ther_id, as this will catch
father_id mother_id
and (almost certainly) nothing else in your data. If you are
really using French then fortuitously (and fortunately)
??re_id
works the same way.)
Nick
[email protected]
BAIJER Jan 212040, Ph.D.
I'm trying to have Stata calculate the number of sibs for each of the
families in a list that is composed as follows :
donor_id
father_id
mother_id
From this, I can calculate a unique identifier for the parent couple, by
concatenation of father_id and mother_id.
But, I have no idea how to proceed for this one ...
*
* 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/