+ Reply to Thread
Results 1 to 3 of 3

Thread: [Stata 11] BHPS: generating household averages?

  1. #1
    Points: 1,456, Level: 21
    Level completed: 56%, Points required for next Level: 44

    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question [Stata 11] BHPS: generating household averages?



    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

  2. #2
    Points: 2,352, Level: 29
    Level completed: 35%, Points required for next Level: 98

    Location
    Paris
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: [Stata 11] BHPS: generating household averages?

    Hey there,

    Let id be the identification variable for household. Just do this:

    bys id : egen m_age = mean(age)

    Etienne

  3. #3
    Points: 1,456, Level: 21
    Level completed: 56%, Points required for next Level: 44

    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: [Stata 11] BHPS: generating household averages?


    Oh my goodness! I actually love you!!!!
    Thank you so much

+ Reply to Thread

Similar Threads

  1. Replies: 3
    Last Post: 03-28-2011, 09:50 PM
  2. Generating a new variable in STATA
    By Infernape in forum Stata
    Replies: 3
    Last Post: 12-18-2010, 04:57 PM
  3. Replies: 0
    Last Post: 06-04-2010, 01:07 AM
  4. Replies: 0
    Last Post: 05-12-2009, 10:44 AM
  5. Help with household survey analysis
    By treinten in forum Psychology Statistics
    Replies: 1
    Last Post: 12-14-2007, 08:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats