Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: re: Weighted mean of prices with quantities as weight


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: Weighted mean of prices with quantities as weight
Date   Thu, 23 Oct 2008 06:46:03 -0400

< >
Bea said

I wrote:

egen newvar = wtmean(price), weight(quantity) if contract=="S", by(date)

but doesn't work.


You have the syntax wrong. If you -ssc desc _gwtmean- you will see that weight() is an option, so it must come after the comma.

. egen junk = wtmean(price) if foreign, weight(displacement) by(rep78)
(52 missing values generated)


Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index