Dear Jared,
tahnk you very much for you suggestion.
I have installed the package, however I need to calculate my weighted
mean for each day and only for some tipe of contract.
I wrote:
egen newvar = wtmean(price), weight(quantity) if contract=="S", by(date)
but doesn't work.
Any suggestion?
Thank you very much.
Best,
Bea
2008/10/23 Jared Delisle <[email protected]>:
> I finally get to chime in! Fairly new to the list (about a week), so here
> goes...
>
> -findit _gwtmean-
>
> Install this package, and you will have a new command, -wtmean-, that works
> as follows:
>
> - egen newvar = wtmean(price), weight(quantity) -
>
> Thanks to David Kantor for this code.
>
> Take care,
> Jared
>
> Beatrice Crozza wrote:
>>
>> Dear all,
>>
>> I would like to construct a weighted mean of prices, taking as weight
>> the quantity for each price.
>>
>> I am using the command egen(mean)
>>
>> How can I instruct Stata to use quantities for each price as weight?
>>
>> Thank you very much.
>>
>> Best,
>> Bea
>> *
>> * 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/