Sounds like a straightforward case for frequency weights, but they are not
allowed with -egen, mean(). So you might -generate- a variable containing
the product of price and quantity and take the mean of that. Also look
at -expand- which may help if quantity is rather low...
HTH
Martin
_______________________
----- Original Message -----
From: "Beatrice Crozza" <[email protected]>
To: <[email protected]>
Sent: Wednesday, October 22, 2008 8:02 PM
Subject: st: Weighted mean of prices with quantities as weight
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/