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" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
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
n.j.cox@durham.ac.uk

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