Announcement

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

  • Different combinations in each household

    I have individual data set. With my dataset I want to create a living arrangement among elderly for each household. For example whether elderly is living alone, living with spouse only, living with spouse and family members. Can some please help me out in creating this new variable with my data. In the below for ro4 relationship with Household head it ranges from (1 to 12 ) and ro5 is age of the respondent.

    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int(stateid distid psuid hhid ro4 ro5)
    1 2 1 2 1 76
    1 2 1 2 3 31
    1 2 1 2 3 42
    1 2 1 2 3 37
    1 2 1 2 4 26
    1 2 1 2 4 40
    1 2 1 2 4 33
    1 2 1 2 5 13
    1 2 1 2 5 8
    1 2 1 2 5 20
    1 2 1 2 5 13
    1 2 1 2 5 19
    1 2 1 2 5 8
    1 2 1 2 12 65
    1 2 1 3 1 45
    1 2 1 3 2 43
    1 2 1 3 3 20
    1 2 1 3 3 12
    1 2 1 3 3 17
    1 2 1 3 3 23
    1 2 1 3 3 14
    1 2 1 4 1 57
    1 2 1 4 2 47
    1 2 1 4 3 13
    1 2 1 4 3 20
    1 2 1 4 3 14
    1 2 1 5 1 50
    1 2 1 5 2 38
    1 2 1 5 3 23
    1 2 1 5 3 16
    1 2 1 5 3 12
    1 2 1 5 3 27
    1 2 1 5 3 18
    1 2 1 6 1 72
    1 2 1 6 3 39
    1 2 1 6 3 27
    1 2 1 6 3 37
    1 2 1 6 4 33
    1 2 1 7 1 52
    1 2 1 7 2 42
    1 2 1 7 3 24
    1 2 1 7 3 16
    1 2 1 7 3 15
    1 2 1 7 3 20
    1 2 1 7 3 18
    1 2 1 7 3 26
    1 2 1 8 1 42
    1 2 1 8 2 37
    1 2 1 8 3 18
    1 2 1 8 3 13
    end
    label values stateid STATEID
    label def STATEID 1 "Jammu & Kashmir 01", modify
    label def RO4 1 "Head 1", modify
    label def RO4 2 "Wife/Husband 2", modify
    label def RO4 3 "Son/Daughter 3", modify
    label def RO4 4 "Child-in-Law 4", modify
    label def RO4 5 "Grandchild 5", modify
    label def RO4 6 "Father/Mother 6", modify
    label def RO4 7 "Brother/Sister 7", modify
    label def RO4 9 "Nephew/Niece 9", modify
    label def RO4 10 "Sib-in-Law 10", modify
    label def RO4 12 "Servant/Others 12", modify



  • #2
    Code:
    by stateid distid psuid hhid, sort: egen lives_with_spouse = max(ro4 == 2)
    by stateid distid psuid hhid: egen lives_with_other_family = max(inrange(ro4, 3, 10))
    by stateid distid psuid hhid: egen lives_alone = min(ro4 == 1)
    by stateid distid psuid hhid: egen lives_with_non_relative = max(ro4 == 12)
    
    label define arrangement    1   "Lives Alone"   ///
                                2   "Lives Only with Spouse" ///
                                3   "Lives with Spouse & Fammily" ///
                                4   "Other Arrangement"
    gen byte arrangement:arrangement = 4
    replace arrangement = 1 if lives_alone
    replace arrangement = 2 if  lives_with_spouse & !(lives_with_other_family ///
        | lives_with_non_relative)
    replace arrangement = 3 if lives_with_spouse & lives_with_other_family

    Comment


    • #3
      Cross-posted at https://stackoverflow.com/questions/...ons-of-a-group

      Please note our policy about cross-posting, which is that you should tell us about. See FAQ Advice.

      Comment


      • #4
        Originally posted by Clyde Schechter View Post
        Code:
        by stateid distid psuid hhid, sort: egen lives_with_spouse = max(ro4 == 2)
        by stateid distid psuid hhid: egen lives_with_other_family = max(inrange(ro4, 3, 10))
        by stateid distid psuid hhid: egen lives_alone = min(ro4 == 1)
        by stateid distid psuid hhid: egen lives_with_non_relative = max(ro4 == 12)
        
        label define arrangement 1 "Lives Alone" ///
        2 "Lives Only with Spouse" ///
        3 "Lives with Spouse & Fammily" ///
        4 "Other Arrangement"
        gen byte arrangement:arrangement = 4
        replace arrangement = 1 if lives_alone
        replace arrangement = 2 if lives_with_spouse & !(lives_with_other_family ///
        | lives_with_non_relative)
        replace arrangement = 3 if lives_with_spouse & lives_with_other_family
        Thanks for your reply sir. the above code only works only if we have elderly, always the head of the household. For example in my data (row15-row21) we don't have any elderly living in the HH, still the code shows me that elderly are living with spouse and family which is not correct.
        Here we may have elderly as head of the household or may be as father to household head (for example elderly son may be head of the household). In this case the father/mother is represented by 6 code and may be their in-laws 8.

        Comment


        • #5
          Oh, I see. That's a lot more complicated. I'm not even sure it's possible given the information. For example, suppose a 65 year old lives in a household headed by his/her 85 year old parent. So the 65 year old's relationship to head is ro4 = 3. Now suppose the household also contains somebody with ro4 = 4 ("Child-in-law"). That other person might be the 65 year old's spouse. But that 65 year old person could also be the spouse of a different child of the household head (and the other child might or might not live in the household). I don't see any way to disambiguate that with the available information. And even if that can be figured out with the help of some other variables, you then need to decide whether in such a situation these two people would be considered to be "family" of the 65 year old or not.

          Comment


          • #6
            Clyde Schechter As You said rightly sir. It will complex if we have hh size more than two or household containing more than two elderly. Keeping in mind about the possible different types of permutations and combinations we have. I wanted to have only three categories in the variable. That is
            1. Elderly living alone (it is simple as hh_size==1 & age>=60).
            2. Elderly living with only spouse
            3. Elderly living with family
            If I can get last two categories it will be great help for me.

            Thanks

            Comment


            • #7
              1. is easy, as you have noted. But 2 is not possible. As I showed in #5, it is not always possible to tell whether an elderly person is living with his/her spouse if the elderly person is not the household head. And whether 3 is possible or not depends on what counts as family. Again, as pointed out in #5, if an elderly person is a child of the head and there is also a child-in-law of the head in the household, then those two will not be related by descent (so, not genetic family) but from a sociologic perspective might be considered family.

              Comment

              Working...
              X