Hello all,
I have a dataset that looks something like this (but with over 70k observations and over 200 firms)
FirmID Area dummy
1 10 1
1 10 1
1 11 1
1 11 1
1 12 0
2 10 1
2 11 0
3 10 1
3 11 1
3 11 1
3 12 1
3 12 1
3 13 0
Each row represents a customer of the firm in that area. And the dummy reflects whether this area is part of the firm's market or not. Now using this data, I want to calculate the total number of customers (including those from other firms) belonging to all areas that constitute a market for a firm, which I am able to do using -by sort- and -egen-. However, after that, or each firm, I want to identify the firms for the customers (and the corresponding number of customers from these firms) in that firm's market. I'm wondering what's a quick way to do this in Stata/
Thank you in advance for any ideas here. And I'm happy to answer any questions if my ask isn't clear!
Related Posts with Help with calculations based on conditions and groups
stack/unstack?Dear All, Suppose that I use -stack- command in the following. Code: webuse stackxmpl, clear . li…
Multiple "lincoms" after "margins" with "at"?Goal: I want to subtract the results of "margins" from a constant. My approach: Use margins with "a…
Compare betas of two different models while using asdoc and reghefe Code: asdoc reghdfe pm rc l.pm interaction1 l.asse /// l.lev if dummy ==0, absorb(cc industry_year_…
spmap to plot dataHi Everyone, I am using the 2015-16 wave of the Demographic and health survey from India, it contai…
Compare similarity of structure (percentage distribution) for one conditionHello guys, I hope someone here can help me with my stata problem. I want to find out if the structu…
Subscribe to:
Post Comments (Atom)
0 Response to Help with calculations based on conditions and groups
Post a Comment