I have panel data on adult women and their husbands, I have a variable (family_id) which is the same for men and women in the same family unit (husbands and wives). Each adult reports his or her own employment status, I would like to create a new variable for the wives based on the employment status of their husbands, i.e. a binary variable "husband_is_unemployed". For the life of me I cannot figure out how to create a variable that summarize properties of the other members of the same family, as is needed above, even using the following: https://www.stata.com/support/faqs/d...ng-properties/ can anyone please advise?
To describe the data:
My initial simple thought was something like the below (where male is 1) but of course this won't apply to the wife, who I am anxious to create the variable on spousal employment for
To describe the data:
Code:
. tab gender
Gender | Freq. Percent Cum.
------------+-----------------------------------
Female | 1,102 62.61 62.61
Male | 658 37.39 100.00
------------+-----------------------------------
Total | 1,760 100.00
. tab binary_employment_y0
Binary No |
Employment? | Freq. Percent Cum.
----------------+-----------------------------------
Some Employment | 1,019 73.05 73.05
No Employment | 376 26.95 100.00
----------------+-----------------------------------
Total | 1,395 100.00
. tab family_id
family_id | Freq. Percent Cum.
------------+-----------------------------------
5 | 1 0.06 0.06
7 | 2 0.11 0.17
8 | 1 0.06 0.23
9 | 2 0.11 0.34
10 | 2 0.11 0.45
12 | 1 0.06 0.51
14 | 2 0.11 0.63
15 | 2 0.11 0.74
18 | 2 0.11 0.85
21 | 2 0.11 0.97
22 | 1 0.06 1.02
23 | 2 0.11 1.14
25 | 2 0.11 1.25
26 | 2 0.11 1.36
28 | 2 0.11 1.48
30 | 1 0.06 1.53
31 | 1 0.06 1.59
32 | 2 0.11 1.70
33 | 1 0.06 1.76
35 | 2 0.11 1.87
36 | 2 0.11 1.99
38 | 2 0.11 2.10
40 | 2 0.11 2.22
41 | 2 0.11 2.33
47 | 2 0.11 2.44
48 | 2 0.11 2.56
57 | 1 0.06 2.61
58 | 2 0.11 2.73
61 | 2 0.11 2.84
63 | 1 0.06 2.90
64 | 2 0.11 3.01
66 | 2 0.11 3.13
67 | 1 0.06 3.18
68 | 2 0.11 3.30
74 | 2 0.11 3.41
80 | 1 0.06 3.47
81 | 2 0.11 3.58
82 | 1 0.06 3.64
83 | 2 0.11 3.75
86 | 2 0.11 3.86
87 | 1 0.06 3.92
88 | 2 0.11 4.03
89 | 2 0.11 4.15
91 | 1 0.06 4.20
93 | 1 0.06 4.26
98 | 2 0.11 4.37
103 | 2 0.11 4.49
108 | 2 0.11 4.60
110 | 2 0.11 4.72
112 | 1 0.06 4.77
116 | 2 0.11 4.89
124 | 2 0.11 5.00
134 | 2 0.11 5.11
135 | 2 0.11 5.23
137 | 2 0.11 5.34
138 | 2 0.11 5.45
141 | 1 0.06 5.51
142 | 2 0.11 5.62
147 | 2 0.11 5.74
153 | 2 0.11 5.85
154 | 2 0.11 5.97
155 | 2 0.11 6.08
156 | 1 0.06 6.14
etc.......
------------+-----------------------------------
Total | 1,760 100.00
.
The frequency above provides a clue that it refers to the relationship between study members because when women and men are married it is two, but when the woman is single it is one.
Code:
generate maleunemployed_y0 =. replace maleunemployed_y0 = 1 if binary_employment_y0==1 & gender == 1 replace maleunemployed_y0 = 0 if binary_employment_y0==0 & gender == 1 generate partnerunemployed_y0 =. replace partnerunemployed_y0 = 1 if maleunemployed_y0==1 & gender == 0 replace partnerunemployed_y0 = 0 if maleunemployed_y0==0 & gender == 0 sort family_id browse id family_id gender maleunemployed_y0 partnerunemployed_y0 binary_employment_y0

Comment