Quite so. But the code I gave should indicate whether you can do that "by hand" in practice.
Nick
[email protected]
Dimitrije Tišma
This would be more helpful if I was only interested in which
individuals move. But, I am rather interested in information on the
household level, i.e. do the households A and B share same members in
the longitudinal perspective? If this is the case, then my goal would
be to consider these two households one "artificial household". I am
thinking of some nice loop, but haven't been able to do it properly
because number of household members varies from one HH to another.
2010/1/17 Nick Cox <[email protected]>:
> It is fairly easy to identify which individuals have belonged to two or more households.
>
> That is
>
> bysort person (household) :
> gen byte changed_hh = household[_N] != household[1]
>
> How do I list observations in a group that differ on a variable?
> http://www.stata.com/support/faqs/data/diff.html
>
> Then you can identify
>
> levelsof household if changed_hh
>
> That sounds like part of your problem.
Dimitrije Tišma
> I am doing a multilevel analysis in Stata (persons | households) but,
> this being longitudinal data, some persons switch to other households
> at some point, so some clusters (i.e. households) have common elements
> (i.e. same id number belonging to different households in different
> years). I was wondering what would be the most efficient way (loop?)
> to identify whether two clusters have common elements.
*
* 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/