Hi all,

I have a problem with merging different family members into 1 family with multiple variables for each fam member.
I have the following example of a larger dataset.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(Famid Age educationlevel Sex smokes incomelevel)
1  9 . 1 . .
1 35 3 2 1 3
1 37 3 1 1 3
2 36 2 1 0 3
2 35 3 2 0 3
3 16 . 1 . .
3 17 . 2 . .
3 47 3 2 0 3
3 45 2 1 0 3
4  8 . 1 . .
4  6 . 1 . .
4 36 3 2 0 2
4 37 3 1 1 2
5 29 2 2 0 2
5 28 3 1 0 2
6  4 . 2 . .
6 32 3 2 0 2
6 31 3 1 0 3
7 14 . 2 . .
7 16 . 2 . .
7 45 3 2 1 2
7 48 1 1 1 3
end
------------------ copy up to and including the previous line ------------------

Listed 22 out of 22 observations

My question is how to merge the id numbers of different families into 1, and to show for family 1 all the observations as variables.
So, to get the following variables for family 1: input byte(Famid Age_child Age_mother educationlevel_mother educationlevel_dad Sex_child smokes_mother smokes_dad incomelevel_mother incomelevel_dad)
Where 1 is male and 2 is female, and for educ level and income level, 1= low, 2= middle, 3= high and smokes --> 0 = no 1= yes
Thank you in advance!