Hi everyone.

I need to do the following: get a weighted average of a subset in a dataset, relabel the rows and use weighted average. I think it is best to explain using the tables below.

In the new dataset, I got the weighted average [total sum of the products of n and ave columns of rows 4 to 6 divided by total sum of n column of rows 4 to 6]. Then call rows 4 to 6 as 11 and use the weighted average as entry in the new dataset.

Thanks heaps for the help.

Yoyong

Original data

Codes | n | ave |
---|---|---|

1 | 25 | 80 |

2 | 10 | 75 |

3 | 15 | 65 |

4 | 25 | 80 |

5 | 30 | 90 |

6 | 30 | 85 |

7 | 40 | 75 |

8 | 60 | 70 |

9 | 10 | 80 |

New dataset

Codes | ave |
---|---|

1 | 80 |

2 | 75 |

3 | 65 |

11 | 85.29 |

7 | 75 |

8 | 70 |

9 | 80 |