Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: creating a variable using -if-? programming needed?


From   "scott.merryman@gmail.com" <scott.merryman@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: creating a variable using -if-? programming needed?
Date   Fri, 16 May 2008 07:36:52 -0700

What defines a partner?  Someone within the same two-person family?

Perhaps something like this:

clear
input site family person personal_labor_income
 1       1            1        2000
 1       1            2        2300
 1       2            1        200
 1       2            3        3000
 2       10           4        3400
 2       10           5        3500
end

bysort site family : gen partner_income = cond(_n ==1,
personal[_n+1],personal[_n-1])

Scott

On Wed, May 14, 2008 at 12:55 PM, Ekaterina Selezneva
<eka.selez@gmail.com> wrote:
> I have a dataset with some information on a sample of married
>  couples. For identifying a single person, one needs to know a
>  "site"-number, "family"-number withing the site, and then the
>  "person"-number within the family. As this is a subsample of some
>  bigger dataset, so not all sites/families/persons are presented in
>  it. Let's say, something like:
>
>  site    family       person   personal_labor_income
>  1       1            1        2000
>  1       1            2        2300
>  1       2            1        200
>  1       2            3        3000
>  2       10           4        3400
>  2       10           5        3500
>
>  THE PROBLEM: I need to create a variable containing the "personal
>  labor income" of partner.
>
>  Unfortunately, I've spent a day, and havn't
>  succeded to solve this seemingly simple problem. I will be grateful for
>  any hints.
>
>  Thanks a lot in advance,
>  Ekaterina
>
*
*   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/

_____________________________________________________________________
Mensaje analizado y protegido por Telefonica Empresas
*
*   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/

Privileged, confidential or patient identifiable information may be contained in this message. This information is meant only for the use of the intended recipients. If you are not the intended recipient, or if the message has been addressed to you in error, do not read, disclose, reproduce, distribute, disseminate or otherwise use this transmission. Instead, please notify the sender by reply e-mail, and then destroy all copies of the message and any attachments.

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