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
Merging and grouping observations by industryHello, I have two datasets which are related, in the first one i have "all types of capital net (so…
Estimating the gravity model using PPLM, general adviceHi, For my thesis I am intending to estimate a gravity model, looking at specifically the effect of…
Logistic postestimation for survey dataHello, I want to do a logistic regression with survey data so I am using the svy prefix. How do I ge…
STATA has started crashing when using the "Browse" button to import CSV filesEssentially as the title describes, STATA has just started crashing when I use the "Browse" button t…
Searching 1) for user written commands and 2) searching my .do filesHello I have 2 questions about searching in Stata 1) which is the best way to search the user/commun…
Subscribe to:
Post Comments (Atom)
0 Response to Help with calculations based on conditions and groups
Post a Comment