[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
HSIUTZU CHANG <hschangbetty@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: calculate the average by subgroup for a panel dataset |

Date |
Wed, 29 Jul 2009 16:02:37 -0400 |

---------- Forwarded message ---------- From: HSIUTZU CHANG <hschangbetty@gmail.com> Date: Wed, Jul 29, 2009 at 2:48 PM Subject: calculate the average by subgroup for a panel dataset To: statalist@hsphsun2.harvard.edu Dear Stata users: How can I calculate the average of serveral variables by the subgroup of another variable? I have a panel dataset of property sale price information and I need to calculate the average of the sale prices (s1, s2, s3) by zipcode area (zip). Since there are missing values in my dataset, I have tried using a command suggested from an eariler thread http://www.stata.com/statalist/archive/2007-02/msg00143.html egen ave= rmean(s1-s3) but this command only calculate the average of s1-s3 for each record. In order to calculate the average of s1-s3 by zip, I tried: bysort zip: egen ave2= rmean(s1-s3) I got an error messaging saying " egen ... rowmean() may not be combined with by r(190)" I am a beginer to STATA, so any suggestions will be welcome! Thank you Betty * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: calculate the average by subgroup for a panel dataset***From:*Scott Merryman <scott.merryman@gmail.com>

**st: AW: calculate the average by subgroup for a panel dataset***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**st: AW: How to Reconcile R2 with Economic Significance** - Next by Date:
**st: AW: calculate the average by subgroup for a panel dataset** - Previous by thread:
**st: cluster analysis with missing data** - Next by thread:
**st: AW: calculate the average by subgroup for a panel dataset** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |