Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: averageifs function in Stata
From
Lisa Wang <[email protected]>
To
[email protected]
Subject
st: averageifs function in Stata
Date
Tue, 24 Jul 2012 13:18:07 +1000
Dear Stata-listers,
I am wondering how I can do something similar to an =averageifs
function from Excel in Stata. I know how to do this in Excel but would
like to learn this in Stata. I am new to Stata, so still often think
about how this would be done in Excel.
I have variables id1 (string) and d_rates (values).
For example:
obs id1 d_rates
1 A56 100
2 A56 89
3 A56 30
4 A56 78
5 A9876 42
6 A9876 86
7 B173 100
8 B173 68
9 B173 47
etc...etc..
I would like some commands in Stata that produces a new variable or
some table where it can tell me what the average d_rates of person
A56, A9876, B173...etc. where there might be a different number of
observations for each id1 (eg. A56 has 4 obs and A9876 has only 2
obs)...
Is this possible?
Thank you for your consideration and time.
Regards,
Lisa
*
* 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/