Announcement

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

  • Unique identifier of individuals inside an household (Panel data)

    Hello,

    I'm currently working on a dataset obtained from a periodical survey of the Bank of Italy (the SHIW). I would like to create a panel of individuals over a certain number of years. The problem is that I cannot create a unique identifier for the individual, because of what follows:
    1) I have the following variables: NQUEST (household identifier numerical code), NORD (individual identifier numerical code inside the household), NORDP (individual identifier numerical code inside the household in the previous year), ANNO (year)
    2) Basically what happens is that the household composition changes over time (a person could die, or a child could marry and form a new household for example), so that also the NORD variable changes.

    I provide you a small sample, so that you can better understand (here what specifically happens is that NORD = 1 and NORD = 2 invert their codes in 2010):

    nquest nord anno nordp
    736917 1 2006 .
    736917 1 2008 1
    736917 1 2010 2
    736917 1 2012 1
    736917 1 2014 1
    736917 1 2016 1
    736917 2 2006 .
    736917 2 2008 2
    736917 2 2010 1
    736917 2 2012 2
    736917 2 2014 2
    736917 2 2016 2
    736917 3 2006 .
    736917 3 2008 3
    736917 3 2010 3
    736917 3 2012 3
    736917 3 2014 3
    736917 3 2016 3
    736917 4 2006 .
    736917 4 2008 4
    736917 4 2010 4
    736917 4 2012 4
    736917 4 2014 4
    736917 4 2016 4

    What I need is a unique_id variable for each individual of each household. Could you help me?

    Thanks in advance!

  • #2
    Simone:
    welcome to this forum.
    You can type -use https://www.stata-press.com/data/r18/nlswork.dta- and inspect the dataset.
    As you will see, most of the time-varying id characteristics were captured via a set of categorical variables.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thank you for your answer, Carlo.
      Though I think you didn't get my question. In the example above, we have data for the household n° 736917 for six years (from 2006 to 2016, every two years). The household is composed by four individuals, identified by a number (nord = 1 is the household's head, n= 2,3,4 are the other members of the family). I want to focus for my analysis on the single individuals, rather than on the household, but the problem is that the order in which these individuals are presented inside the household changes from year to year (in the example from 2008 to 2010 this happens for individuals 1 and 2), so I need to uniquely identify them across the years. You see that the order of the household's member change, and this change is captured by the variable nordp (that says us what number that individual was in the previous year). My question is how can I create a new variable, call it unique_id, which identifies exactly each individuals? I hope that it's more clear now, thanks in advance.

      Comment


      • #4
        Simone:
        what about:
        Code:
        . egen wanted=group( nquest nord) if nord!=.
        
        . replace wanted=1 if wanted !=.
        This code should track a single individual within the same HH.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment

        Working...
        X