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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

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

Date |
Wed, 29 Jul 2009 16:10:13 -0400 |

<> You would probably be better -reshape-ing the data to long form. See ****** help reshape ****** under "Remarks". Then you can indeed apply -bysort- to your problem... HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von HSIUTZU CHANG Gesendet: Mittwoch, 29. Juli 2009 16:03 An: statalist@hsphsun2.harvard.edu Betreff: st: calculate the average by subgroup for a panel dataset ---------- 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/ * * 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/

**References**:**st: calculate the average by subgroup for a panel dataset***From:*HSIUTZU CHANG <hschangbetty@gmail.com>

- Prev by Date:
**st: calculate the average by subgroup for a panel dataset** - Next by Date:
**Re: st: calculate the average by subgroup for a panel dataset** - Previous by thread:
**st: calculate the average by subgroup for a panel dataset** - Next by thread:
**Re: st: 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 |