Announcement

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

  • #16
    what this error message means is that, contrary to your apparent belief, SHHID appears in more than one observation - just as Stata has told you; if this should not be true, then you need to find them; e.g.,
    Code:
    sort SHHID
    edit if SHHID==SHHID[_n-1] | SHHID==SHHID[_n+1]
    or
    Code:
    duplicates report SHHID
    help duplicates
    and then decide what to do with them

    note that I ended the last set of commands with a help - looking at this help file will lead you to some alternatives for finding out what is going on

    Comment


    • #17
      Hi Rich,

      Thank you for this. I will try to sort out the duplicate issue and run the code again.

      Reesha

      Comment


      • #18
        Hi All,

        Andrew has further assisted me with sorting out the duplicates and everything works well. A massive thank you to everyone for all of the assistance - I really appreciate it.

        Best,
        Reesha

        Comment


        • #19
          Just to close out this thread by explaining the issue of duplicate observations encountered by Reesha which may be relevant to anyone employing the approach in #4. The warning is to be careful when concatenating strings! When I replaced the string id (uqnr) with a numerical id (ruqnr) in #4, for observation 9169 in Reesha's dataset, we had ruqnr= 2385. In turn, for observation 91757, we had ruqnr=23851. Because I defined the sub-household identifier as ruqnr+rperson, it just hapenned that the target individual in the latter household had rperson=12, and thus SHHID for this household= 238512. Meanwhile, the target individual in the former household had rperson=2 resulting in (ouch!) SHHID =238512, a match.


          Code:
          . list uqnr person ruqnr rperson if SHHID=="238512"
          
                  +------------------------------------------+
                  | uqnr            person   ruqnr   rperson |
                  |------------------------------------------|
            9169. | 1302042000901       12    2385        12 |
           91757. | 9131030000101       02   23851         2 |
                  +------------------------------------------+
          I simply replaced SHHID= uqnr+rperson to define the SHHID (because uqnr is more random), and this solved the issue.

          Comment

          Working...
          X