Hi everyone:

Below is a sample of a dataset that I have been working on.

HH ID Relationship to Head Spouse ID Father ID Mother ID Schooling
1045 1 1 2 . . 16
1045 2 4 1 . . 15
1045 3 5 . 1 2 7
1045 4 5 . 1 2 5
HH is the household identifier; ID is the household member id; Relationship to Head is the relationship of each household member with the head of the family (1 if individual is the Head; 4 if spouse and 5 if children); spouse ID is the ID of spouse (same for father id and mother id). So in the table above, 1 is the father, 2 mother and 3 and 4 are the children in the household.

I want to create the following variables:

1. A dummy variable for each members of the household for whether that member is the Head of the household;
2. For each mother in the household, a variable for the number of children she has;
3. For each husband/wife, a variable for the schooling of their spouse.

I have 7440 households in my dataset. I would really appreciate if anyone could help me with this.

Thanks!