Announcement

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

  • Tracking individuals' characteristics through multiple waves of data

    Dear Statalisters,

    I have individual level data for years 2007 and 2009 for many variables. I'm trying to look at the changes between 2007 and 2009. For instance, I'd like to focus on the labor market outcomes and see which individuals went from being employed to unemployed (and conversely) and which individuals went from having no labor contract to having a labor contract or self-employed. Is there any way I can track these changes with a relatively simple command and neatly regroup them in a table?

    For example, I want to track the change of individual with Personnalnumber=100501 going from laborcontract=1 to laborcontract=4.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long Personnalnumber int year byte laborcontract
    100501 2009 4
    100501 2007 1
    101401 2009 2
    101401 2007 2
    102501 2009 6
    102501 2007 6
    102502 2007 2
    102502 2009 6
    103101 2009 3
    103101 2007 4
    103102 2009 3
    103102 2007 4
    103103 2009 .
    103103 2007 .
    103104 2009 .
    103104 2007 .
    103301 2009 2
    103301 2007 3
    103501 2007 2
    103501 2009 2
    103901 2007 1
    103901 2009 1
    end
    Thank you for your help!!

  • #2
    Originally posted by Candice Yandam View Post
    Dear Statalisters,

    I have individual level data for years 2007 and 2009 for many variables. I'm trying to look at the changes between 2007 and 2009. For instance, I'd like to focus on the labor market outcomes and see which individuals went from being employed to unemployed (and conversely) and which individuals went from having no labor contract to having a labor contract or self-employed. Is there any way I can track these changes with a relatively simple command and neatly regroup them in a table?

    For example, I want to track the change of individual with Personnalnumber=100501 going from laborcontract=1 to laborcontract=4.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long Personnalnumber int year byte laborcontract
    100501 2009 4
    100501 2007 1
    101401 2009 2
    101401 2007 2
    102501 2009 6
    102501 2007 6
    102502 2007 2
    102502 2009 6
    103101 2009 3
    103101 2007 4
    103102 2009 3
    103102 2007 4
    103103 2009 .
    103103 2007 .
    103104 2009 .
    103104 2007 .
    103301 2009 2
    103301 2007 3
    103501 2007 2
    103501 2009 2
    103901 2007 1
    103901 2009 1
    end
    Thank you for your help!!

    I would start looking at IF-statements.

    Comment


    • #3
      Candice:
      you may also want to consider -xttrans-:
      Code:
      . xtset Personnalnumber year
             panel variable:  Personnalnumber (strongly balanced)
              time variable:  year, 2007 to 2009, but with gaps
                      delta:  1 unit
      
      . xttrans laborcontract
      
      laborcontr |                     laborcontract
             act |         1          2          3          4          6 |     Total
      -----------+-------------------------------------------------------+----------
               1 |     50.00       0.00       0.00      50.00       0.00 |    100.00
               2 |      0.00      66.67       0.00       0.00      33.33 |    100.00
               3 |      0.00     100.00       0.00       0.00       0.00 |    100.00
               4 |      0.00       0.00     100.00       0.00       0.00 |    100.00
               6 |      0.00       0.00       0.00       0.00     100.00 |    100.00
      -----------+-------------------------------------------------------+----------
           Total |     11.11      33.33      22.22      11.11      22.22 |    100.00
      
      
      
      
      . xttrans laborcontract, freq
      
      laborcontr |                     laborcontract
             act |         1          2          3          4          6 |     Total
      -----------+-------------------------------------------------------+----------
               1 |         1          0          0          1          0 |         2
                 |     50.00       0.00       0.00      50.00       0.00 |    100.00
      -----------+-------------------------------------------------------+----------
               2 |         0          2          0          0          1 |         3
                 |      0.00      66.67       0.00       0.00      33.33 |    100.00
      -----------+-------------------------------------------------------+----------
               3 |         0          1          0          0          0 |         1
                 |      0.00     100.00       0.00       0.00       0.00 |    100.00
      -----------+-------------------------------------------------------+----------
               4 |         0          0          2          0          0 |         2
                 |      0.00       0.00     100.00       0.00       0.00 |    100.00
      -----------+-------------------------------------------------------+----------
               6 |         0          0          0          0          1 |         1
                 |      0.00       0.00       0.00       0.00     100.00 |    100.00
      -----------+-------------------------------------------------------+----------
           Total |         1          3          2          1          2 |         9
                 |     11.11      33.33      22.22      11.11      22.22 |    100.00
      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Great! Thank you both for your help

        Comment

        Working...
        X