Re: Compute mean by grouping variable excluding observation

@AstoundingThanks for this, I should have specified that I do have missing values for R, I, and Cat. I think that will cause a problem here. I'll look into this and Reeza's response to see if missing data is properly accounted for and post back.

Re: Compute mean by grouping variable excluding observation

@Astounding Indeed, missing data is problematic here, but *appears* to be dealt with in the Proc SQL follow-ups. Hopefully we can get a follow-up on the handling of missing data yet with the two Proc SQL examples provided. Thanks for your help!

Re: Compute mean by grouping variable excluding observation

As above, I should have specified that I do have missing values for R, I, and Cat. Will this be accounted for via the "count" argument?

Your code produced means within groups, but it created the same mean value for RE and IE for everyone in a given "Cat" group. Eveyone should have a slightly different average because the average should be calculated leaving out their unique observation (as per the "want" example). What can be done to ensure the RE and IE are calculated leaving out each individual observation within the given "Cat" group?