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]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Breadwinner variable |

Date |
Wed, 22 Feb 2012 18:17:55 +0000 |

gen coupleid = /// string(min(individual, spouse)) + " " + string(max(individual, spouse)) bysort coupleid wave : gen difference = earnings - earnings[3 - _n] if _N == 2 Notes: 1. You need an identifier for each couple. 2. If and only if there are two observations for each couple and each wave, the other person's earnings are in 3 - _n. That is because if _n is 1 then 3 - _n is 2, and vice versa. Note that bysort coupleid wave : gen difference = earnings[1] - earnings[2] if _N == 2 is not what you want. See also SJ-8-4 dm0043 . Tip 71: The problem of split identity, or how to group dyads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q4/08 SJ 8(4):588--591 (no commands) tip on how to handle dyadic identifiers Nick n.j.cox@durham.ac.uk Peter Gambrill I have data like this Wave Individual Spouse Earnings Difference 1 101 102 x1 x1-y1 2 101 102 x2 x2-y2 3 101 102 x3 x3-y3 1 102 101 y1 y1-x1 2 102 101 y2 y2-x2 3 102 101 y3 y3-x3 I need to create a variable that shows how much more or less one individual (101) in the couple earns compared to the other individual (102). Is there anyway of doing this? Something like the variable "Difference" above Also for each couple they don't always have observations for the same number of waves as each other or as the next couple in the data. * * 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/

**References**:**st: Breadwinner variable***From:*Peter Gambrill <shortmoneyconspiracy@gmail.com>

- Prev by Date:
**st: Breadwinner variable** - Next by Date:
**Re: st: Breadwinner variable** - Previous by thread:
**st: Breadwinner variable** - Next by thread:
**Re: st: Breadwinner variable** - Index(es):