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
ommited control variableHello, I have a sample of 158 firms. I control for industry, and I have 26 industry dummies. One of…
missed ANOVA Matrix in OLS regressionArray Hi, it is my results for Ols regression and doesn't have ANOVA matrix but my tutor results sho…
Quantile regressionHello, I'm doing a thesis on the basis of RAND HIE data. I would like to run a quantile regression w…
Two errors - don't understand whyCan anyone advise? Code: . use "Z:\Data\jt\survival.dta" . capture erase "Z:\Data\jt\file.dta" . …
Using -margins- for different subsamplesHi everyone, margins, atmeans saves the means of covariates of a model in a matrix r(at), see here:…
Subscribe to:
Post Comments (Atom)
0 Response to Weighted Sum in Collapse
Post a Comment