Dear All,
May you kindly assist with the following. I am using survey data and trying to get the number of individuals that receive pensions in the same household. This should be a count variable, if there are 2 people then the new variable must be 2 for that household ID, etc. I will be using the variable as one of my controls. I have added a sample of the data below. The first column is a dummy variable of if the person is getting a pension or not (yes or no). The second column is the household ID.
* Example generated by -dataex-. For more info, type help dataex
clear
input byte w5_a_incgovpen long w5_hhid
. 512245
2 513525
. 506667
. 501754
. 512342
. 505473
. 508574
. 503184
. 500609
2 510137
. 503476
2 509386
1 500170
. 511941
. 507137
. 506211
. 503777
2 503308
. 513774
. 500230
Thank you and best regards!
Comment