Hi All,
I would like to average the income values between head's and spouse's in my dataset. Heads and Spouses will have the same interview number within the same year. So for example, the first two observations are a coupled head and spouse, so I would like their individual incomes to to be 4114 instead of 4208 and 4020. But the third observation to stay as is - 15552. How can I do this for all observations? Additionally, is there a way to do this for many income variables at once?
Many thanks in advance,
Cora
I would like to average the income values between head's and spouse's in my dataset. Heads and Spouses will have the same interview number within the same year. So for example, the first two observations are a coupled head and spouse, so I would like their individual incomes to to be 4114 instead of 4208 and 4020. But the third observation to stay as is - 15552. How can I do this for all observations? Additionally, is there a way to do this for many income variables at once?
Many thanks in advance,
Cora
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(totalincome ID) int year float(intnum head spouse) 4208 443172 2017 1 . 1 4020 443003 2017 1 1 . 15552 459001 2013 2 1 . 67000 2000030 2019 2 . 1 7800 581003 2013 3 1 . 13800 431002 2019 3 1 . 41170 1459003 2005 4 1 . 22836 750001 2007 4 1 . 33000 6838177 2017 4 1 . 32000 2862003 2019 4 1 . 32883 161004 2015 5 1 . 42400 1880003 2015 6 1 . 17500 855171 2017 6 1 . 20000 45173 2007 7 1 . 18000 45003 2007 7 . 1 20000 2722003 2013 7 . 1 41000 2722171 2013 7 1 . 19538 649001 2013 8 1 . 21800 6112005 2015 8 1 . end

Comment