1. I want to create a new variable called headwage using HOURLYWAGE and to ensure that it appears in front of each household member and I want to ensure that for each head the wage is his/her average in both the rounds.
I have tried the following commands: g headwage= HOURLYWAGE if RELATIONSHIPTOHEAD==1
egen headinc=max(headwage),by(IDHH)
However, I do not whether it is correct or not?
2. I want to keep the eldest child in the household using the age variable. However, I cannot figure it out.
IDHH is the unique Household ID
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(RELATIONSHIPTOHEAD AGE) double HOURLYWAGES str10 IDHH 3 16 . "010204010" 5 13 . "010203010" 3 38 25.095785141 "010203010" 5 1 . "010203010" 1 45 41.4161186219 "010207010" 4 36 . "010203010" 3 11 . "010206010" 3 22 8.469827652 "010201010" 3 13 . "010201010" 3 20 . "010204010" 11 7 . "010204010" 5 6 . "010203010" 3 21 . "010207010" 2 34 . "010202010" 3 16 9.4060611725 "010206010" 3 15 . "010204010" 6 65 . "010207010" 7 60 . "010203010" 7 18 35.2909507752 "010205010" 3 2 . "010205010" 3 18 . "010206010" 4 34 . "010203010" 1 45 71.7997131348 "010204010" 5 5 . "010203010" 3 34 25.095785141 "010203010" 3 13 . "010204010" 3 7 . "010201010" 5 6 . "010203010" 2 25 . "010205010" 1 70 . "010203010" 2 37 . "010204010" 2 60 . "010203010" 3 4 . "010205010" 3 14 . "010202010" 3 15 . "010206010" 2 40 9.4060611725 "010206010" 2 40 . "010207010" 3 13 . "010206010" 5 3 . "010203010" 3 9 . "010202010" 5 10 . "010203010" 1 27 70.5819015503 "010205010" 6 66 . "010204010" 3 15 . "010202010" 3 5 . "010204010" 1 36 19.4125137329 "010202010" 1 50 27.3772220612 "010201010" 1 45 . "010206010" 2 45 . "010201010" 7 32 . "010302010" 2 65 . "010308010" 1 40 59.0434799195 "010307010" 1 37 42.0755500794 "010302010" 3 31 41.5256690979 "010301010" 3 33 56.5083541871 "010305010" 1 50 41.1363639832 "010304010" 2 57 . "010303010" 3 20 49.3636360169 "010301010" 5 7 . "010303010" 5 12 . "010305010" 3 14 . "010301010" 2 65 . "010305010" 5 0 . "010301010" 3 15 . "010306010" 2 55 . "010301010" 5 1 . "010305010" 1 80 . "010305010" 5 1 . "010305010" 5 2 . "010301010" 2 34 63.1133232117 "010302010" 1 60 34.3826332093 "010301010" 4 32 8.2455730438 "010308010" 2 50 . "010309010" 5 5 . "010305010" 3 30 . "010309010" 3 20 . "010301010" 4 31 . "010305010" 3 24 . "010309010" 3 17 . "010301010" 3 15 . "010307010" 3 19 . "010304010" 2 39 . "010307010" 4 30 . "010301010" 6 58 . "010302010" 3 30 65.818183899 "010306010" 5 10 . "010308010" 3 13 . "010307010" 10 30 . "010302010" 5 7 . "010305010" 3 28 . "010309010" 1 55 . "010306010" 3 20 . "010301010" 2 45 . "010304010" 3 36 5.8787879944 "010308010" 5 6 . "010306010" 3 24 . "010306010" 5 4 . "010308010" 11 70 . "010306010" 3 40 29.3939399719 "010308010" 5 8 . "010308010" end label values RELATIONSHIPTOHEAD RO4 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 10 "Sib-in-Law 10", modify label def RO4 11 "Other rel 11", modify
0 Response to Creating new variables on the basis of relationship to head, age and wages?
Post a Comment