turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- How to calculate mean of a variable excluding the ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-18-2014 02:53 PM

I'm try to compute the mean of a variable (A) for its joint industry (X), performance (Y) decile, where the mean excludes the obs itself. I already created deciles for variable Y within each industry X,

but can't figure out how to calculate the mean of each decile excluding the obs. Any suggestions are much appreciated!

Accepted Solutions

Solution

08-18-2014
03:17 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-18-2014 03:17 PM

Amanda,

I'm assuming that you already know how to compute the mean for each X/Y group, how to save the results as a SAS data set, and how to merge that back into the original data. (If not, you will have some studying ahead of you.)

Getting the mean excluding the current observation is not very different. Instead of computing the mean, compute the SUM and N statistics for each X/Y group. Save the results as a SAS data set. Merge it back onto the original data. Using the same step that merges SUM and N back onto the data, add a few statements to calculate the mean. For example:

MEAN = (SUM - A) / (N - 1);

The programming may be easy or difficult, depending on which parts you already know how to do.

Good luck.

All Replies

Solution

08-18-2014
03:17 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-18-2014 03:17 PM

Amanda,

I'm assuming that you already know how to compute the mean for each X/Y group, how to save the results as a SAS data set, and how to merge that back into the original data. (If not, you will have some studying ahead of you.)

Getting the mean excluding the current observation is not very different. Instead of computing the mean, compute the SUM and N statistics for each X/Y group. Save the results as a SAS data set. Merge it back onto the original data. Using the same step that merges SUM and N back onto the data, add a few statements to calculate the mean. For example:

MEAN = (SUM - A) / (N - 1);

The programming may be easy or difficult, depending on which parts you already know how to do.

Good luck.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-18-2014 03:47 PM

Thanks. It works like a charm!