Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: cross grouping a family w siblings and stepsiblings
From
Tinne Steffensen <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
Re: st: cross grouping a family w siblings and stepsiblings
Date
Mon, 2 May 2011 14:04:10 +0000
Thank you for the link. The problem is I don't have any family id - as have all the examples in the link. The reason is, that I'm both interested in stepsiblings on the mother's and father's side, which makes it impossible to make distinct families. (Some children will be part of two families).
Instead I will try to go back to the datasets prior to merging;
It looks like this, where group_m is (by m_id, sort: gen group_m = _n).
m_Id child_id gender group_m birth handicap
1 24 2 1 01jan07 1
1 12 2 2 02feb08 0
2 47 1 1 10jun02 0
3 10 2 1 02apr00 0
4 8 2 1 18dec09 1
4 18 1 2 11nov02 1
4 56 1 3 18may99 0
5 82 1 1 23jun08 0
6 12 2 1 30jul01 0
I want it to come out like below.
m_Id child_id1 child_id2 child_id3 birth1 birth2 birth3
1 24 12 . 01jan07 02feb08 .
2 47 . . 10jun02 . .
3 10 . . 02apr00 . .
4 8 18 56 18dec09 11nov02 18may99
5 82 . . 23jun08 . .
6 12 . . 30jul01 . .
I tried reshaping:
reshape wide child_id, i(m_id) j(gr_m)
But it comes up with this error-message:
(note: j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)
Birth not constant within m_id
-
In the real dataset there are up to 20 children to each mother.
Thank you for your time. Tinne
*
* 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/