Announcement

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

  • Calculating the Unemployment Rate using Micro Data

    I'm currently trying to create a graph which displays the female unemployment rate vs the male rate within my data over a period of time. However, the data I have only has the employment status of each individual not the overall rates. I have generated a binary "unemployed" variable for each individual equal to 1 if they are unemployed and 0 if not. However, I do not know how to calculate either the overall unemployment rate or the rate of each sex. I think maybe I should be using the egen command but I am unsure.

  • #2
    The mean of this variable represents the proportion of unemployed individuals.

    Code:
    *OVERALL BY YEAR
    bys year: egen wanted1= mean(unemployed)
    *OVERALL BY GENDER AND YEAR
    bys sex year: egen wanted2= mean(unemployed)

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      The mean of this variable represents the proportion of unemployed individuals.

      Code:
      *OVERALL BY YEAR
      bys year: egen wanted1= mean(unemployed)
      *OVERALL BY GENDER AND YEAR
      bys sex year: egen wanted2= mean(unemployed)
      Thanks for replying.
      I tried the code you suggested but when I summarise and tabulate the "wanted1" variable it says it has the number of observations of the entire population. The same applied with the code when sorting by sex. Is this not incorrect if I'm trying to generate a variable for only those unemployed?

      Comment


      • #4
        The mean value is generated for each observation in the sample. If you have multiple observations of the same individual in a group, you want to tag only one observation. You can use egen's -tag()- function.

        Code:
        *TAG ONE OBSERVATION PER INDIVIDUAL-YEAR COMBINATION
        egen tag= tag(id year)
        bys year: sum wanted1 if tag
        bys year sex: sum wanted2 if tag
        where "id" is your individual identifier. Consider displaying these values using tabdisp:

        Code:
        tabdisp year, cell(wanted1)
        tabdisp year sex, cell(wanted2)

        Just to be clear, the mean here represents the proportion of unemployed individuals in a year (wanted1) or proportion of unemployed individuals of a given gender in a year (wanted2). So wanted2=0.2 for sex=female and year=2020 implies that 20% of females among the sample of females in 2020 were unemployed.
        Last edited by Andrew Musau; 27 Mar 2021, 10:46.

        Comment

        Working...
        X