Good day,
I have a panel data set and I need assistance with calculating the age difference of couples in a family. I started by generating new variables of married male and married females. After that I generated another variable that subtracts the two. I did that using egen agediff = mmale - mfemale. However, the agediff variable is empty. I am not sure why that is the case.
I was wondering if I can be able to get this difference within the household using the household ID to ensure that I am using the ages of people in the same household? The sample of my data is below.
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input long hhid float(mmale mfemale)
103034 . .
220050 . .
304902 . .
405085 . .
512245 . .
103037 . .
210778 . .
302440 . .
412925 . .
513525 . .
103037 . .
210778 . .
302440 . .
412925 . .
513525 . .
103037 . .
210778 . .
302440 . .
412925 . .
513525 . .
103050 . 49
220052 . .
305851 . .
414998 . .
506667 . .
103046 . .
220051 . .
301578 . .
411987 . .
501754 . .
103046 . .
220051 . .
301578 34 .
411001 . .
509386 . .
103049 . .
220494 . .
308713 . .
407658 . .
512342 . .
103049 . .
220494 . .
308713 . .
407658 . .
512342 . .
103049 84 .
220494 . .
308713 . .
407658 . .
512342 . .
103034 . .
220050 . .
304902 . .
405085 . .
512245 . .
107090 . .
212791 . .
305588 . .
415006 . .
503184 . .
103034 . .
220050 . .
304902 . .
405085 . .
512245 . .
103045 48 .
210781 48 .
308048 . .
411782 . .
500609 . .
103052 71 .
210782 71 .
304048 71 .
405398 . .
. . .
103059 . .
210784 . .
307030 . .
400945 . .
510137 . .
103046 . .
220051 . .
301578 . .
411987 . .
501754 . .
103045 . 40
210781 . .
308048 . .
411782 . .
500609 . .
103058 . .
210783 . .
308285 . .
411829 . .
503476 . .
103058 . .
210783 . .
308285 . .
411829 . .
503476 . .
Thanking you in advance!
I have a panel data set and I need assistance with calculating the age difference of couples in a family. I started by generating new variables of married male and married females. After that I generated another variable that subtracts the two. I did that using egen agediff = mmale - mfemale. However, the agediff variable is empty. I am not sure why that is the case.
I was wondering if I can be able to get this difference within the household using the household ID to ensure that I am using the ages of people in the same household? The sample of my data is below.
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input long hhid float(mmale mfemale)
103034 . .
220050 . .
304902 . .
405085 . .
512245 . .
103037 . .
210778 . .
302440 . .
412925 . .
513525 . .
103037 . .
210778 . .
302440 . .
412925 . .
513525 . .
103037 . .
210778 . .
302440 . .
412925 . .
513525 . .
103050 . 49
220052 . .
305851 . .
414998 . .
506667 . .
103046 . .
220051 . .
301578 . .
411987 . .
501754 . .
103046 . .
220051 . .
301578 34 .
411001 . .
509386 . .
103049 . .
220494 . .
308713 . .
407658 . .
512342 . .
103049 . .
220494 . .
308713 . .
407658 . .
512342 . .
103049 84 .
220494 . .
308713 . .
407658 . .
512342 . .
103034 . .
220050 . .
304902 . .
405085 . .
512245 . .
107090 . .
212791 . .
305588 . .
415006 . .
503184 . .
103034 . .
220050 . .
304902 . .
405085 . .
512245 . .
103045 48 .
210781 48 .
308048 . .
411782 . .
500609 . .
103052 71 .
210782 71 .
304048 71 .
405398 . .
. . .
103059 . .
210784 . .
307030 . .
400945 . .
510137 . .
103046 . .
220051 . .
301578 . .
411987 . .
501754 . .
103045 . 40
210781 . .
308048 . .
411782 . .
500609 . .
103058 . .
210783 . .
308285 . .
411829 . .
503476 . .
103058 . .
210783 . .
308285 . .
411829 . .
503476 . .
Thanking you in advance!
Comment