Bookmark and Share

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]

Re: st: averageifs function in Stata


From   Lisa Wang <[email protected]>
To   [email protected]
Subject   Re: st: averageifs function in Stata
Date   Tue, 24 Jul 2012 16:32:20 +1000

Hi Billy,

Thank you for your prompt response and pointing me in the right
direction. The collapse command works well for what I want to achieve!

Regards,
Lisa


On Tue, Jul 24, 2012 at 1:39 PM, William Buchanan
<[email protected]> wrote:
> Look at the help file for collapse.  That should do what you want it to.
>
> HTH,
> Billy
>
> Sent from my iPhone
>
> On Jul 23, 2012, at 20:18, Lisa Wang <[email protected]> wrote:
>
>> 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/
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index