Announcement

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

  • How to generate household ID from HIES data without members info

    I am working with HIES data. Following is the data where S9EQ00 is the durable item code a household owns. HHID is the household identification number.
    (TERM PSU HHID S9EQ00 S9EQ01 S9EQ02)
    1 1 6 1016 1 1
    1 1 6 1017 2 .
    1 1 6 1018 2 .
    1 1 6 1019 1 1
    1 1 6 1020 1 1
    1 1 6 1026 2 .
    1 1 6 1027 1 1
    1 1 6 1028 2 .
    1 1 6 1029 2 .
    1 1 6 1031 1 1
    1 1 6 1032 2 .
    1 1 6 1033 1 1
    1 1 6 1034 2 .
    1 1 6 1043 2 .
    1 1 9 1016 1 1
    1 1 9 1017 2 .
    1 1 9 1018 2 .
    1 1 9 1019 1 2
    1 1 9 1020 1 2
    1 1 9 1026 2 .
    1 1 9 1027 1 1
    1 1 9 1028 2 .
    1 1 9 1029 2 .
    1 1 9 1031 2 .
    1 1 9 1032 2 .
    1 1 9 1033 2 .
    1 1 9 1034 2 .
    1 1 9 1043 1 1
    1 1 14 1016 1 1
    1 1 14 1017 2 .
    1 1 14 1018 2 .
    1 1 14 1019 1 2
    1 1 14 1020 1 2
    1 1 14 1026 2 .
    1 1 14 1027 2 .
    1 1 14 1028 2 .
    1 1 14 1029 2 .
    1 1 14 1031 2 .
    1 1 14 1032 2 .
    1 1 14 1033 2 .
    1 1 14 1034 2 .
    1 1 14 1043 2 .
    1 1 28 1016 2 .
    1 1 28 1017 2 .
    1 1 28 1018 2 .
    1 1 28 1019 2 .
    1 1 28 1020 1 3
    1 1 28 1026 2 .
    1 1 28 1027 2 .
    1 1 28 1028 2 .
    1 1 28 1029 2 .
    1 1 28 1031 2 .
    1 1 28 1032 2 .
    1 1 28 1033 2 .
    1 1 28 1034 2 .
    1 1 28 1043 2 .
    1 1 29 1016 2 .
    1 1 29 1017 2 .
    1 1 29 1018 2 .
    1 1 29 1019 2 .
    1 1 29 1020 1 2
    1 1 29 1026 2 .
    1 1 29 1027 2 .
    1 1 29 1028 2 .
    1 1 29 1029 2 .
    1 1 29 1031 2 .
    1 1 29 1032 2 .
    1 1 29 1033 2 .
    1 1 29 1034 2 .
    1 1 29 1043 2 .
    1 1 33 1016 1 1
    1 1 33 1017 2 .
    1 1 33 1018 2 .
    1 1 33 1019 2 .
    1 1 33 1020 1 2
    1 1 33 1026 2 .
    1 1 33 1027 1 1
    1 1 33 1028 2 .
    1 1 33 1029 2 .
    1 1 33 1031 2 .
    1 1 33 1032 2 .
    1 1 33 1033 2 .
    1 1 33 1034 2 .
    1 1 33 1043 2 .
    1 1 38 1016 1 1
    1 1 38 1017 2 .
    1 1 38 1018 2 .
    1 1 38 1019 1 2
    1 1 38 1020 1 1
    1 1 38 1026 2 .
    1 1 38 1027 1 1
    1 1 38 1028 2 .
    1 1 38 1029 2 .
    1 1 38 1031 2 .
    1 1 38 1032 2 .
    1 1 38 1033 2 .
    1 1 38 1034 2 .
    1 1 38 1043 2 .
    1 1 45 1016 2 .
    1 1 45 1017 2 .
    end
    label values S9EQ00 S9EQ00
    label def S9EQ00 1016 "TV set", modify
    label def S9EQ00 1017 "Desktop Computer", modify
    label def S9EQ00 1018 "Laptop Computer", modify
    label def S9EQ00 1019 "Mobile Handset (Smart Phone)", modify
    label def S9EQ00 1020 "Mobile Handset (Feature/Button Phone)", modify
    label def S9EQ00 1026 "Microwave/ Electric Oven", modify
    label def S9EQ00 1027 "Refreigerator/Fridger", modify
    label def S9EQ00 1028 "*Air Conditioner/ Cooler (AC)", modify
    label def S9EQ00 1029 "Washing Machine", modify
    label def S9EQ00 1031 "Bicycle", modify
    label def S9EQ00 1032 "Rikshaw/Auto-Rikshaw/Easybike", modify
    label def S9EQ00 1033 "Motorcycle/Scooter", modify
    label def S9EQ00 1034 "Motor Car", modify
    label def S9EQ00 1043 "Boat/Engine Boat", modify
    My question is how can I generate household ID number from this data?

  • #2
    Didn't you begin by noting:

    HHID is the household identification number.
    ?

    What is the difference between "HHID" and the household identifier that you want to generate?

    Comment


    • #3
      Please close the thread you started at https://www.statalist.org/forums/for...ld-member-data if it is no longer pertinent.

      Comment


      • #4
        Each PSU has more than 100 HHID, so the HHID number is repeating. Household identifier is a unique code for each household which I want to generate

        Comment


        • #5
          Code:
          egen wanted_HHID= group(PSU HHID)
          But do not do this separately in different files if you need to merge datasets. Do it only in your final merged dataset.

          Comment


          • #6
            I cannot merge without the household identifier variable, otherwise it will not merge accurately

            Comment


            • #7
              I see that the issue has been resolved in the other thread you started, linked in #3. To answer your question on why you cannot use the -group()- function of egen to create identifiers in different datasets, it's important to understand that the values generated by the -group()- function may not be guaranteed to be unique for a combination of variables. This is because the combinations of variables may vary across datasets, and egen assigns values sequentially using only available combinations. Therefore, to ensure uniqueness, it's necessary to merge the datasets first (using multiple key variables) and then create the identifier in the final merged dataset.

              Comment

              Working...
              X