Hey there,
Let id be the identification variable for household. Just do this:
bys id : egen m_age = mean(age)
Etienne
Hi folks,
I'm trying to generate the average of a variable for a household. My data is in long format and each individual has a household identification number (ie:14004357): each household usually has more than 1 individual.
How can I generate a variable which is the average (say, age) of all the members of the household? There are around 10,000 households so obviously i cannot do this manually. Any help much appreciated.
Thanks,
Chris
Hey there,
Let id be the identification variable for household. Just do this:
bys id : egen m_age = mean(age)
Etienne
Oh my goodness! I actually love you!!!!
Thank you so much
|
|