Hi,
I am working with firm-level data (cross-section data). I am trying to calculate the weighted sum of product Gross Value by (i) Product Code (given by productASICC) and (ii) State
I am using collapse command as follows:
(i) For Weighted Sum by Product Code
collapse (sum) sum_output=productGrossValue [aw=emult2] , by(productASICC)
(ii) For Weighted Sum by State
collapse (sum) sum_output=productGrossValue [aw=emult2], by(state)
However, when I collapse the two (separately) and then calculate the total of sum_output, I get a different answer in each case!
Total Sum (when doing (i))= 7956141480645.23
Total Sum (when doing(ii))=5334065631590.61
Please let me know if I am doing anything wrong! My gut is that, the two sums should be equal. But I dont know if my code is incorrect or not.
Thanks
Dhruv
Related Posts with Weighted Sum in Collapse
Creating frequencies from list of 30,000 observations saved as stringsI have a list of 30,000 plus observations which represent patient diagnoses. They are saved in strin…
Help with combining 2 shapefilesHi, I have previosly worked with the "spmap" command, so Im familiar with it. But now im trying to d…
Multilevel Multinomial logistic regression with group-level variablesHello, I am trying Multilevel Multinomial logistic regression with gsem command. However, there's a …
General QuestionHello, Kindly let me know why it is recommended to use OLS and Fixed effect model before using GMM. …
Xtlogit with weights workaroundHi, I'm trying to run a random effects logit models with weights. The syntax I was trying was xtol…
Subscribe to:
Post Comments (Atom)
0 Response to Weighted Sum in Collapse
Post a Comment