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]

From |
Nick Cox <njcoxstata@gmail.com> |

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

Subject |
Re: st: How to calculate weighted mean |

Date |
Thu, 5 Dec 2013 18:52:40 +0000 |

Anthony guessed right, but for future questions please note that This is my code ... and this is what went wrong ... . is immensely more helpful than just My code seems to be not working. Nick njcoxstata@gmail.com On 5 December 2013 18:41, Xixi Lin <winnielxx@gmail.com> wrote: > Thanks, Anthony. > > And thanks, Nick. > > That solves my problem! > > Best, > Xixi Lin > > On Thu, Dec 5, 2013 at 1:36 PM, Thomas, Anthony > <anthony_h_thomas@brown.edu> wrote: >> Yep, egen can have multiple variables in the "by" option. They should >> be separated with a space though (not a comma as in the example >> above). Also options are separated by spaces as well, not commas. >> >> Anthony >> >> On Thu, Dec 5, 2013 at 1:31 PM, Xixi Lin <winnielxx@gmail.com> wrote: >>> Hi Nick, >>> >>> Thanks for pointing this out. Btw, is it possible for egen to both run >>> by country and by period? My code seems to be not working that way. >>> >>> Best, >>> Xixi Lin >>> >>> On Thu, Dec 5, 2013 at 1:12 PM, Nick Cox <njcoxstata@gmail.com> wrote: >>>> That is a user-written program from SSC. You need to install it using >>>> >>>> . ssc inst _gwtmean >>>> >>>> >>>> Nick >>>> njcoxstata@gmail.com >>>> >>>> >>>> On 5 December 2013 18:07, Xixi Lin <winnielxx@gmail.com> wrote: >>>>> Hi, >>>>> >>>>> I am trying to calculate weighted average return by country and by >>>>> period. Here is my code: >>>>> egen capweight_return = wtmean(Return_lead1), weight(Market_Cap), >>>>> by(Country, Period) >>>>> >>>>> But the stata says "unknown egen function wtmean()", does anyone knows >>>>> how to fix that? >>>>> >>>>> Thanks. >>>>> >>>>> Best, >>>>> Xixi Lin >>>>> * >>>>> * For searches and help try: >>>>> * http://www.stata.com/help.cgi?search >>>>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: How to calculate weighted mean***From:*Xixi Lin <winnielxx@gmail.com>

**References**:**st: How to calculate weighted mean***From:*Xixi Lin <winnielxx@gmail.com>

**Re: st: How to calculate weighted mean***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: How to calculate weighted mean***From:*Xixi Lin <winnielxx@gmail.com>

**Re: st: How to calculate weighted mean***From:*"Thomas, Anthony" <anthony_h_thomas@brown.edu>

**Re: st: How to calculate weighted mean***From:*Xixi Lin <winnielxx@gmail.com>

- Prev by Date:
**Re: st: How to calculate weighted mean** - Next by Date:
**Re: st: higher occurrence of disease X in rare disease Y** - Previous by thread:
**Re: st: How to calculate weighted mean** - Next by thread:
**Re: st: How to calculate weighted mean** - Index(es):