Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SIPP Panel data, adding spouse info to reference person

    Hello,

    Apologies if this question is answered elsewhere, my searches have not yet located it.

    I am using the Survey of Income and Program Participation panel dataset, and have combined 4 panels from 96-08. The dataset surveys multiple people per household, all multiple times. To use the data I created a unique participant ID for all individuals. egen sippid = concat(spanel ssuid epppnum).

    I want to associate the spouse's country of birth (cob) with the record of the spouse for all individuals (or at the least with the reference person). I have the id variable and also created a unique household id, as well as variables for marital status (1, single, 2 married...) and a variable for the relationship of the person to the reference person (errp: errp==1 is reference person, errp==3 is spouse of the reference person). Data looks something like this (cob is numeric, just used names for example purposes here):

    id hhid ms errp cob
    1 1 2 1 usa
    2 1 2 3 usa
    3 1 1 4 usa
    4 2 2 1 .
    5 2 2 3 mexico

    I am not sure how to do this, everything I think through doesn't make sense. Initially I thought I would just extract all the spouses with their id and cob and merge them back on their reference person, but I can't quite get 2 files that will fit together.

    I created a unique variable for the id of the reference person of the hh (egen refperhhsippid=concat(spanel ssuid shhadid ehrefper)) and thought I might be able to use that in matching them but I keep ending up confusing myself.

    Any chance you can help me figure this out? If my questions/data set up is not clear, or this is overly simple and I can find the answer elsewhere, please let me know and I will try again, I'm new to asking questions here.

    Thank you!
    Jen

  • #2
    Please use dataex in the future to present data examples. Assuming that "cob" is a numerical variable with value labels, the following will assign the spouse's country of origin to each household member. If "cob" is a string variable, there are several ways to do this, including -help encode- followed by the code below.

    Code:
    bys hhid: egen spcob= max(cond(errp==3, cob,.))

    Comment

    Working...
    X