Hello Stata users!
I think the following is a very easy question, but I'm just a beginner with Stata so I'm trying to learn more and more everyday! :-)
I have the following variables in my dataset:
It is a survey with ID of the family interviewed, the number of components of each family, and the income of each person.
I would like to create a new variable (Fam_income) that for each component reports the family's income (as a sum of the income of each component)
Just like that:
Someone can help me, please?
Thanks in advance!
I think the following is a very easy question, but I'm just a beginner with Stata so I'm trying to learn more and more everyday! :-)
I have the following variables in my dataset:
ID_Family | N_components | Income |
1 | 3 | 0 |
1 | 3 | 1000 |
1 | 3 | 0 |
2 | 4 | 10000 |
2 | 4 | 500 |
2 | 4 | 0 |
2 | 4 | 3500 |
3 | 1 | 20000 |
4 | 2 | 5000 |
4 | 2 | 0 |
I would like to create a new variable (Fam_income) that for each component reports the family's income (as a sum of the income of each component)
Just like that:
ID_Family | N_components | Income | Fam_income |
1 | 3 | 0 | 1000 |
1 | 3 | 1000 | 1000 |
1 | 3 | 0 | 1000 |
2 | 4 | 10000 | 14000 |
2 | 4 | 500 | 14000 |
2 | 4 | 0 | 14000 |
2 | 4 | 3500 | 14000 |
3 | 1 | 20000 | 20000 |
4 | 2 | 5000 | 5000 |
4 | 2 | 0 | 5000 |
Thanks in advance!
Comment