Announcement

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

  • Calculating employment growth rates for different regions and sectors and saving results as variables

    Hello everyone,

    I have establishment-data for firms in (West-)Germany. The variables are: establishment id (betnr), district code (ao_kreis), no. of employees (az_ges), the year (jahr) as well as the economic sector (w93_3_gen). I want to calculate the log-run employment growth rate of some sector s in region r (g_rs) between two time periods 1976 (0) and 2016 (1):
    grs=(emprs1-emprs0)/emprs0
    The same I want to do for a region's aggregate employment g_r: gr=(empr1-empr0)/empr0
    and the national rate of employment growth g_nat. gnat=(emp1-emp0)/emp0
    And finally saving the results as variables to be able to use them in further calculations.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long betnr int ao_kreis float az_ges int(jahr w93_3_gen)
     92551  9162   1 2016 950
    555882  6531   1 2016 741
    795440  9663   1 2016 672
    931872  9187  16 2016 452
    591129  5314   7 2016 285
    424245  7211   1 2016 702
    836497  3451   1 2016 950
    680007  9185   5 2016 552
    283072  9189   2 2016 702
    963470  8315   2 2016 703
     40454  3454   1 2016 702
    355318  9162   1 2016 950
    981360  8119   8 2016 285
    800345  5334   1 2016 703
    788098  6412   1 2016 524
      7583  5119  82 2016 261
    174300  3459   2 2016 950
    462246  3353   1 2016 555
    149523  9773   1 2016 453
    462684  5112   1 2016 453
    183000  1054  21 2016 634
    450433  9163  22 2016 551
    915680  1058   1 2016 741
    110599  8212   1 2016 950
    455606  5758   1 2016 950
    166390  5158   4 1976 514
    598569  7313   1 2016 950
    654403  9174   3 2016 452
    186194  9175   4 2016 851
    185208  5315   2 2016 741
    342714  9663  19 2016 853
    196854  8225   1 2016 950
    259521  3359   1 2016 702
     73468  5124   1 2016 702
    890700  4011   1 2016 741
    273530  8126   1 2016 524
    342782  7338   1 2016 602
    341541  6440   1 2016 950
    765833  9172   1 2016 950
    621167  5315   1 2016 804
    386343  5113   1 2016 511
    271486  9563 234 2016 551
     10812  8226   1 2016 950
    821438  9571   1 2016 950
    449622  8118   1 2016 950
    773426  5978   3 2016 672
    893968  3241   1 2016 526
    701704  3454   2 2016 851
    378616  8221   1 2016 742
    606884  9777   1 2016 703
    558396  1061   1 2016 930
    466523  6633   1 2016 950
    509691  5315  21 2016 222
    235469  7334   1 2016 950
    259121  9577   4 2016 950
    798761  3452   1 2016 851
    256259  5758   1 2016 950
    915088 11000   7 2016 632
    325398  5758   8 2016 722
    298128  3256  25 2016 521
    961916  9764  12 2016 553
    650157 11000   4 2016 524
    930849  5978   1 2016 950
    673404  5370   1 2016 526
    582639  5334   1 2016 702
    932961  8215   1 2016 950
    582044  5962   1 2016 950
    710341  6433  40 2016 551
    892127  5315  10 2016 453
    410674  2000   1 2016 701
    556446  9162   1 2016 454
     38026  5314   2 2016 747
    796632 11000  13 2016 553
    831147  8125   1 2016 702
    112937  5116   4 2016 742
    894821  8136 116 2016 502
    580989 11000   3 2016 526
     17258  5362   1 2016 851
    276468  5358  33 2016 853
    148480  3241   6 2016 950
    395549  5762   1 2016 747
    390765  8317   3 2016 950
     23197  3459   1 1976 741
    395173  9472   1 2016 950
    197086  1053   1 2016  12
    815243  6432   5 2016 524
    347378  3154  18 2016 552
    422482  9275   1 2016 702
    129571  5314  10 2016 950
    759016  3153  11 2016 553
    985148  7235   1 2016 362
    372707  9275   2 1976 158
    339197  1062   4 2016 523
    954455  8231   1 2016 222
    653356  8327  23 2016 634
    523605  9162   1 2016 950
     51090  8335   1 2016 950
    978211  9162   1 2016 950
    440684  5954   1 2016 950
    920620  3359   9 2016 158
    end
    label values betnr miss_en
    label values az_ges miss_en
    label values ao_kreis ao_kreis_en
    label def ao_kreis_en 1053 "1053  Herzogtum Lauenburg", modify
    label def ao_kreis_en 1054 "1054  Nordfriesland", modify
    label def ao_kreis_en 1058 "1058  Rendsburg-Eckernfoerde", modify
    label def ao_kreis_en 1061 "1061  Steinburg", modify
    label def ao_kreis_en 1062 "1062  Stormarn", modify
    label def ao_kreis_en 2000 "2000  Hamburg, Free and Hanseatic City", modify
    label def ao_kreis_en 3153 "3153  Goslar", modify
    label def ao_kreis_en 3154 "3154  Helmstedt", modify
    label def ao_kreis_en 3241 "3241  Region Hannover", modify
    label def ao_kreis_en 3256 "3256  Nienburg (Weser)", modify
    label def ao_kreis_en 3353 "3353  Harburg", modify
    label def ao_kreis_en 3359 "3359  Stade", modify
    label def ao_kreis_en 3451 "3451  Ammerland", modify
    label def ao_kreis_en 3452 "3452  Aurich", modify
    label def ao_kreis_en 3454 "3454  Emsland", modify
    label def ao_kreis_en 3459 "3459  Osnabrueck", modify
    label def ao_kreis_en 4011 "4011  Bremen, City", modify
    label def ao_kreis_en 5112 "5112  Duisburg, City", modify
    label def ao_kreis_en 5113 "5113  Essen, City", modify
    label def ao_kreis_en 5116 "5116  Moenchengladbach, City", modify
    label def ao_kreis_en 5119 "5119  Oberhausen, City", modify
    label def ao_kreis_en 5124 "5124  Wuppertal, City", modify
    label def ao_kreis_en 5158 "5158  Mettmann", modify
    label def ao_kreis_en 5314 "5314  Bonn, City", modify
    label def ao_kreis_en 5315 "5315  Koeln, City", modify
    label def ao_kreis_en 5334 "5334  Staedteregion Aachen", modify
    label def ao_kreis_en 5358 "5358  Dueren", modify
    label def ao_kreis_en 5362 "5362  Rhein-Erft-Kreis", modify
    label def ao_kreis_en 5370 "5370  Heinsberg", modify
    label def ao_kreis_en 5758 "5758  Herford", modify
    label def ao_kreis_en 5762 "5762  Hoexter", modify
    label def ao_kreis_en 5954 "5954  Ennepe-Ruhr-Kreis", modify
    label def ao_kreis_en 5962 "5962  Maerkischer Kreis", modify
    label def ao_kreis_en 5978 "5978  Unna", modify
    label def ao_kreis_en 6412 "6412  Frankfurt am Main, City", modify
    label def ao_kreis_en 6432 "6432  Darmstadt-Dieburg", modify
    label def ao_kreis_en 6433 "6433  Gross-Gerau", modify
    label def ao_kreis_en 6440 "6440  Wetteraukreis", modify
    label def ao_kreis_en 6531 "6531  Giessen", modify
    label def ao_kreis_en 6633 "6633  Kassel", modify
    label def ao_kreis_en 7211 "7211  Trier, City", modify
    label def ao_kreis_en 7235 "7235  Trier-Saarburg", modify
    label def ao_kreis_en 7313 "7313  Landau in der Pfalz, City", modify
    label def ao_kreis_en 7334 "7334  Germersheim", modify
    label def ao_kreis_en 7338 "7338  Rhein-Pfalz-Kreis", modify
    label def ao_kreis_en 8118 "8118  Ludwigsburg", modify
    label def ao_kreis_en 8119 "8119  Rems-Murr-Kreis", modify
    label def ao_kreis_en 8125 "8125  Heilbronn", modify
    label def ao_kreis_en 8126 "8126  Hohenlohekreis", modify
    label def ao_kreis_en 8136 "8136  Ostalbkreis", modify
    label def ao_kreis_en 8212 "8212  Karlsruhe, City", modify
    label def ao_kreis_en 8215 "8215  Karlsruhe", modify
    label def ao_kreis_en 8221 "8221  Heidelberg, City", modify
    label def ao_kreis_en 8225 "8225  Neckar-Odenwald-Kreis", modify
    label def ao_kreis_en 8226 "8226  Rhein-Neckar-Kreis", modify
    label def ao_kreis_en 8231 "8231  Pforzheim, City", modify
    label def ao_kreis_en 8315 "8315  Breisgau-Hochschwarzwald", modify
    label def ao_kreis_en 8317 "8317  Ortenaukreis", modify
    label def ao_kreis_en 8327 "8327  Tuttlingen", modify
    label def ao_kreis_en 8335 "8335  Konstanz", modify
    label def ao_kreis_en 9162 "9162  Muenchen, Capital of the Federal State", modify
    label def ao_kreis_en 9163 "9163  Rosenheim, City", modify
    label def ao_kreis_en 9172 "9172  Berchtesgadener Land", modify
    label def ao_kreis_en 9174 "9174  Dachau", modify
    label def ao_kreis_en 9175 "9175  Ebersberg", modify
    label def ao_kreis_en 9185 "9185  Neuburg-Schrobenhausen", modify
    label def ao_kreis_en 9187 "9187  Rosenheim", modify
    label def ao_kreis_en 9189 "9189  Traunstein", modify
    label def ao_kreis_en 9275 "9275  Passau", modify
    label def ao_kreis_en 9472 "9472  Bayreuth", modify
    label def ao_kreis_en 9563 "9563  Fuerth, City", modify
    label def ao_kreis_en 9571 "9571  Ansbach", modify
    label def ao_kreis_en 9577 "9577  Weissenburg-Gunzenhausen", modify
    label def ao_kreis_en 9663 "9663  Wuerzburg, City", modify
    label def ao_kreis_en 9764 "9764  Memmingen, City", modify
    label def ao_kreis_en 9773 "9773  Dillingen a.d.Donau", modify
    label def ao_kreis_en 9777 "9777  Ostallgaeu", modify
    label def ao_kreis_en 11000 "11000  Berlin, City", modify
    label values w93_3_gen w93_3_gen_en
    label def w93_3_gen_en 12 "12  Farming of animals", modify
    label def w93_3_gen_en 158 "158  Manufacture of other food products", modify
    label def w93_3_gen_en 222 "222  Printing and service activities related to printing", modify
    label def w93_3_gen_en 261 "261  Manufacture of glass and glass products", modify
    label def w93_3_gen_en 285 "285  Treatment and coating of metals; general mechanical engineering", modify
    label def w93_3_gen_en 362 "362  Manufacture of jewellery and related articles", modify
    label def w93_3_gen_en 452 "452  Building of complete constructions or parts thereof; civil engineering", modify
    label def w93_3_gen_en 453 "453  Building installation", modify
    label def w93_3_gen_en 454 "454  Building completion", modify
    label def w93_3_gen_en 502 "502  Maintenance and repair of motor vehicles", modify
    label def w93_3_gen_en 511 "511  Wholesale an a fee or contract basis", modify
    label def w93_3_gen_en 514 "514  Wholesale of household goods", modify
    label def w93_3_gen_en 521 "521  Retail sale in non-specialized stores", modify
    label def w93_3_gen_en 523 "523  Retail sale of pharmaceutical and medical goods, cosmetic and tollet articles", modify
    label def w93_3_gen_en 524 "524  Other retail sale of new goods in specialized stores", modify
    label def w93_3_gen_en 526 "526  Retail sale not in stores", modify
    label def w93_3_gen_en 551 "551  Hotels", modify
    label def w93_3_gen_en 552 "552  Camping sites and other provision of short-stay accommodation", modify
    label def w93_3_gen_en 553 "553  Restaurants", modify
    label def w93_3_gen_en 555 "555  Canteens and catering", modify
    label def w93_3_gen_en 602 "602  Other land transport", modify
    label def w93_3_gen_en 632 "632  Other supporting transport activities", modify
    label def w93_3_gen_en 634 "634  Activities of other transport agencies", modify
    label def w93_3_gen_en 672 "672  Activities auxiliary to insurance and pension funding", modify
    label def w93_3_gen_en 701 "701  Real estate activities with own property", modify
    label def w93_3_gen_en 702 "702  Letting of own property", modify
    label def w93_3_gen_en 703 "703  Real estate activities an a fee or contract basis", modify
    label def w93_3_gen_en 722 "722  Software consultancy and supply", modify
    label def w93_3_gen_en 741 "741  Legal, accounting, book-keeping and auditing activities; tax consultancy; market research and public opinion polling; business and management consultancy; holdings", modify
    label def w93_3_gen_en 742 "742  Architectural and engineering activities and related technical consultancy", modify
    label def w93_3_gen_en 747 "747  Industrial cleaning", modify
    label def w93_3_gen_en 804 "804  Adult and other education", modify
    label def w93_3_gen_en 851 "851  Human health activities", modify
    label def w93_3_gen_en 853 "853  Social work activities", modify
    label def w93_3_gen_en 930 "930  Other service activities", modify
    label def w93_3_gen_en 950 "950  Private households with employed persons", modify

    I'm relatively new to Stata, so I don't know how to implement this. Could you help me?

    Greetings,
    Lorenz

  • #2
    Hi Lorenz,

    Unfortunately the dataset you provided does not allow to try running example code (you only provided data on the year 2016, not on 1976)

    I guess something like this might be a starting point for you:
    Code:
    sort region sector firm
    by region sector: gen employment1976 = employment  if  year == 1976
    by region sector: gen employment2016 = employment  if  year == 2016
    
    gen delta_employment = employment1976 - employment2016
    Maybe some more experienced user could look into this.

    Comment

    Working...
    X