Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: -collapse- and weights


From   "Rodrigo Martell" <[email protected]>
To   <[email protected]>
Subject   st: -collapse- and weights
Date   Mon, 13 Nov 2006 18:48:53 +1100

I don't think this got through to the list since I didn't receive it after I sent it. Anyway, here it goes again:

I have a data set that looks like this:

--------------------------------------------------------------------------------------------

week     price     quantity     Manufacturer

1             3.5         40                     A

1             9.1         50                     B

1             10.5       70                     B

1             20         80                     B

2             45         70                     A

2             3.1        100                   A

2             15         10                     A

2             28         15                     B

--------------------------------------------------------------------------------------------

I ultimately want to end up with this:

--------------------------------------------------------------------------------------------

week     weigthedprice_A     weightedprice_B

1             3.5                         13.95

2             20.05556                 28

-------------------------------------------------------------------------------------------

 

In other words, I want to sum the quantity-weighted price for each week by Manufacturer.

I used the following but can't quite get the weights option right:

-collapse (mean) price [*? some weights option here,I can't quite get it*], by(week Manufacturer)-

-reshape wide price, i(week) j(Manufacturer) string-

I'd appreciate any help.

Thanks!

Rodrigo



Rodrigo Martell

 <http://www.frontier-economics.com> 	
Frontier Economics Pty. Ltd.
395 Collins Street
Melbourne VIC 3000
Australia
www.frontier-economics.com 	
switch:
direct:
fax:
mobile:
email:


+61 (0)3 9620 4488
+61 (0)3 9613 1518
+61 (0)3 8614 2711
+61 (0)407 909 811
[email protected] <mailto:[email protected]> 


This e-mail, including any attachments, may contain confidential and privileged information for the sole use of the intended recipient(s). Any review, use, disclosure or distribution by others is strictly prohibited. If you are not the intended recipient (or authorised to receive information for the recipient), please contact the sender by reply e-mail and delete all copies of this message. Thank you.

	

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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