Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: Husbands and wives [was: st: RE: RE: RE: data


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: Husbands and wives [was: st: RE: RE: RE: data
Date   Fri, 12 Jul 2002 17:14:11 +0100

asad
>
> And for the MEANS:
>
> bysort hhold g_id ns : egen meanage = mean(age) if ns
> by hhold g_id : gen S_age = meanage[2] if _n == 1
> by hhold g_id : replace S_age = meanage[1] if S_age ==
> .
>
> But the above doesnt create correct Spouse_age for
> those with OK==0 i.e. monogamous couples. Rather it
> assigns the average age to each i.e. husband and wife
> get the same (average) age. Hence, the first command
> line (for means) should be as follows:
>
> bysort hhold S_id: egen meanS_age = mean(Age) if
> S_id~=.

Correct, of course. Thanks for wrapping up the thread.

Nick
[email protected]

*
*   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/



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