Statalist


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

st: calculate the average by subgroup for a panel dataset


From   HSIUTZU CHANG <[email protected]>
To   [email protected]
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 <[email protected]>
Date: Wed, Jul 29, 2009 at 2:48 PM
Subject: calculate the average by subgroup for a panel dataset
To: [email protected]


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/



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