Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to find the mean of subset of individuals

    I have data from several thousand observations on education level (discrete variable that ranges from 0-18) and i need to find the mean wage for each level individual of education. For example, there are 15 people who identify as education level 0. I'd like to find out the mean wage for those 15 people, and so on for each level of education. If anyone can help i'd be immensely grateful.

  • #2
    Try

    egen meanwage = mean(wage), by(education)

    or

    tabstat wage, by(education)

    Comment


    • #3
      Thanks a lot, the second command worked! Do you think its possible to do the same, but for the median, or it would only work with the mean?

      Comment


      • #4
        by looking at
        Code:
        help tabstat
        you can see which statistics are included (and, yes, the median is there)

        Comment


        • #5
          I tried this: tabstat wage76, by(grade), statistics(median), but STATA said 'statistics' was invalid. This is what i inferred from looking and the help page, i'm probably making a dumb error as i'm very new to STATA. Any further guidance would be greatly appreciated

          Comment


          • #6
            Too many commas.

            Code:
            tabstat wage76, by(grade)  statistics(median)
            Also, if you want the mean, don't ask for the median. (It would usually be a good idea to look at both.)

            See also https://www.statalist.org/forums/help#spelling

            Comment

            Working...
            X