Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculating the employment based concentration in a local labor market

    Dear readers,

    I am in the middle of my master's thesis and I reached a point where I want to calculate the employment based concentration in local labor markets. After having defined the labor markets I have two variables in my dataset: Total number of employees (per observed company) and Local Labour Market.

    I would like to see the total amount of employees in each of these labor markets. Intuitively I wanted to use the tab command but I get the error "too many values". I also tried the list command but it did not work for me either, since it was showing me the number of employees in each company in the same labor market.

    Is there any way to do this? If so, I kindly ask for your tips.


    Thank you in advance!

    PG

  • #2
    Working from descriptions of data, rather than example data, always involves some guesswork about how the data really are organized--that's why it is usually a good idea to show example data when asking for help with code.

    That said, based on what I imagine your data to look like, I think you want something like this:
    Code:
    by local_labor_market, sort: egen total_employees = total(company_employees)
    egen tag = tag(local_labor_market)
    list local_labor_market total_employees if tag, noobs
    Of course, if your data are actually different from what I imagine, this code will either not work at all or generate nonsense results. In that case, please be sure to include actual example data when you post back, and be sure to use the -dataex- command to do that to assure that the example will be usable. If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment

    Working...
    X