Announcement

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

  • Can this be done? Averaging with missing values

    Hello,

    i have three variables. I want to get the average of these variables, however I have missing data.

    So for example, if I have one person who has scored 8 in one variable, 6 in another variable and missing data in the third variable, the average I would want would be 7, as this is the average of the two scores available. However by having that missing value in the third variable, the average would 4.6.

    can it be done so that you have a code that gives you the average score from available data whether they be from one, two or three variables?

  • #2
    this is exactly what the "rowmean" function of the -egen- command is for; see
    Code:
    help egen

    Comment


    • #3
      Egen also has the rowmiss and rownonmiss functions. These can be handy if, say, you want to specify a minimum number of values that need to be nonmissing before you compute the mean.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://www3.nd.edu/~rwilliam

      Comment


      • #4
        Excellent thank you

        Comment

        Working...
        X