Announcement

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

  • Merging two dataset

    Hi Dear Profs and colleagues,

    Thank you so much for the assistance you have done so far, I really appreciated the time you take to guide, solve and help us.
    My question has 2 sections.
    Section A:
    I have two dataset
    First one is the total number of new arriving immigrants from source country K at time t (decennial: 1960-1970-1990-2000-2010)
    Code:
    use data_1
    
    input str21 Country int Year long new_arrive
    "FR" 2010   5111
    "FR" 2011   5293
    "FR" 2012   5201
    "FR" 2013   5268
    "FR" 2014   6541
    "FR" 2015   8440
    "FR" 2016  11293
    "FR" 2017  15319
    "FR" 2018  19771
    "FR" 2019  23125
    "FR" 2020  24935
    "FR" 2021  26719
    "IT" 2010   5067
    "IT" 2011   5338
    "IT" 2012   5222
    "IT" 2013   5121
    "IT" 2014   5328
    "IT" 2015   6130
    "IT" 2016   8523
    "IT" 2017  12925
    "IT" 2018  18862
    "IT" 2019  25408
    "IT" 2020  28159
    "IT" 2021  30819
    "AN" 2010  23233
    "AN" 2011  21329
    "AN" 2012  19873
    "AN" 2013  19967
    "AN" 2014  19478
    "AN" 2015  18088
    "AN" 2016  16876
    "AN" 2017  16764
    "AN" 2018  18310
    "AN" 2019  22592
    "AN" 2020  24409
    "AN" 2021  25751
    "CV" 2010  43510
    "CV" 2011  43475
    "CV" 2012  42388
    "CV" 2013  42011
    "CV" 2014  40563
    "CV" 2015  38346
    "CV" 2016  36193
    "CV" 2017  34706
    "CV" 2018  34444
    "CV" 2019  37110
    "CV" 2020  36466
    "CV" 2021  33988
    "GB" 2010  19304
    "GB" 2011  18131
    "GB" 2012  17462
    "GB" 2013  17574
    "GB" 2014  17728
    "GB" 2015  16817
    "GB" 2016  15306
    "GB" 2017  14951
    "GB" 2018  15960
    "GB" 2019  18780
    "GB" 2020  19664
    "GB" 2021  20346
    "MO" 2010   3109
    "MO" 2011   2995
    "MO" 2012   2901
    "MO" 2013   2825
    "MO" 2014   2813
    "MO" 2015   2787
    "MO" 2016   2823
    "MO" 2017   2814
    "MO" 2018   2999
    "MO" 2019   3488
    "MO" 2020   3675
    "MO" 2021   3795
    "ST" 2010  10175
    "ST" 2011  10274
    "ST" 2012  10174
    "ST" 2013  10169
    "ST" 2014  10028
    "ST" 2015   9405
    "ST" 2016   8840
    "ST" 2017   8478
    "ST" 2018   9023
    "ST" 2019  10078
    "ST" 2020  10646
    "ST" 2021  11176
    "BR" 2010 119195
    "BR" 2011 111295
    "BR" 2012 105518
    "BR" 2013  91238
    "BR" 2014  85288
    "BR" 2015  80515
    "BR" 2016  79569
    "BR" 2017  83061
    "BR" 2018 104504
    "BR" 2019 150919
    "BR" 2020 183875
    "BR" 2021 204669
    "CH" 2010  15600
    "CH" 2011  16595
    "CH" 2012  17186
    "CH" 2013  18445
    end
    The second dataset is the immigrant share from source country K, which was in skill group ij (Expgroup sk_rat_qurtile) in 1960.
    Code:
    use data_2
    
    input str2 Country float Expgroup byte sk_rat_quartile float IMshare
    "AN" 2 1   .10526316
    "AN" 2 2   .05263158
    "AN" 3 1   .05263158
    "AN" 3 3   .02631579
    "AN" 3 4   .05263158
    "AN" 4 1   .07894737
    "AN" 4 2   .02631579
    "AN" 4 4   .02631579
    "AN" 5 1   .02631579
    "AN" 5 2   .05263158
    "AN" 5 3   .02631579
    "AN" 5 4   .07894737
    "AN" 6 1   .07894737
    "AN" 6 2   .05263158
    "AN" 6 3   .02631579
    "AN" 6 4   .02631579
    "AN" 7 1   .07894737
    "AN" 7 2   .02631579
    "AN" 7 3   .02631579
    "AN" 8 1   .02631579
    "AN" 8 3   .02631579
    "AN" 8 4   .02631579
    "BR" 1 1   .02838454
    "BR" 1 2  .029344695
    "BR" 1 3    .0256241
    "BR" 1 4  .005040807
    "BR" 2 1     .081253
    "BR" 2 2   .06277005
    "BR" 2 3   .05142823
    "BR" 2 4  .014402305
    "BR" 3 1   .10783725
    "BR" 3 2   .07459193
    "BR" 3 3   .04860778
    "BR" 3 4  .015722515
    "BR" 4 1   .09115458
    "BR" 4 2   .05244839
    "BR" 4 3   .02994479
    "BR" 4 4  .012542007
    "BR" 5 1   .06018963
    "BR" 5 2   .03612578
    "BR" 5 3  .017342774
    "BR" 5 4  .009301488
    "BR" 6 1   .04086654
    "BR" 6 2   .02262362
    "BR" 6 3  .009661546
    "BR" 6 4  .007081133
    "BR" 7 1    .0243639
    "BR" 7 2  .011461833
    "BR" 7 3  .004740758
    "BR" 7 4 .0044407104
    "BR" 8 1  .011041767
    "BR" 8 2  .004800768
    "BR" 8 3   .00300048
    "BR" 8 4 .0018602976
    "CH" 1 1  .015873017
    "CH" 1 2   .04761905
    "CH" 1 3  .031746034
    "CH" 1 4  .031746034
    "CH" 2 1  .031746034
    "CH" 2 2  .071428575
    "CH" 2 3   .05555556
    "CH" 2 4  .023809524
    "CH" 3 1  .007936508
    "CH" 3 2    .0952381
    "CH" 3 3  .007936508
    "CH" 3 4  .023809524
    "CH" 4 2    .0873016
    "CH" 4 3   .03968254
    "CH" 4 4  .015873017
    "CH" 5 1  .015873017
    "CH" 5 2    .1031746
    "CH" 5 3  .031746034
    "CH" 5 4  .023809524
    "CH" 6 2   .05555556
    "CH" 6 3   .03968254
    "CH" 6 4  .031746034
    "CH" 7 1  .015873017
    "CH" 7 2  .023809524
    "CH" 7 4  .031746034
    "CH" 8 1  .015873017
    "CH" 8 2  .015873017
    "CH" 8 4  .007936508
    "CV" 1 1   .04908464
    "CV" 1 2    .0379411
    "CV" 1 3   .02892014
    "CV" 1 4  .006633059
    "CV" 2 1  .067922525
    "CV" 2 2   .05386044
    "CV" 2 3     .040329
    "CV" 2 4  .010612895
    "CV" 3 1   .06659591
    "CV" 3 2  .029450784
    "CV" 3 3  .016715309
    "CV" 3 4  .007959671
    "CV" 4 1     .080658
    "CV" 4 2   .02600159
    "CV" 4 3  .008755638
    "CV" 4 4   .00557177
    "CV" 5 1   .09312815
    "CV" 5 2   .02467498
    end
    Target is: multiplying IMshare by new_arrive
    Code:
    g Predicted_no=IMshare*new_arrive
    To reach this end:
    Code:
    use data_1
    joinby Country using data_2
    
    g Predicted_no=IMshare*new_arrive
    
    
    . list if Country=="FR"
    
          +------------------------------------------------------------------------------+
          | Country   Year   new_ar~e   Expgroup   sk_rat~e   share   IMshare   Predic~o |
          |------------------------------------------------------------------------------|
       1. |      FR   2010       5111          1          3      26       0.0     123.73 |
       2. |      FR   2010       5111          3          3      46       0.0   218.9069 |
       3. |      FR   2010       5111          1          1      21       0.0   99.93575 |
       4. |      FR   2010       5111          6          4      21       0.0   99.93575 |
       5. |      FR   2010       5111          2          3      41       0.0   195.1127 |
          |------------------------------------------------------------------------------|
       6. |      FR   2010       5111          2          2      35       0.0   166.5596 |
       7. |      FR   2010       5111          3          4      76       0.1   361.6722 |
       8. |      FR   2010       5111          8          1       4       0.0   19.03538 |
       9. |      FR   2010       5111          8          2       7       0.0   33.31192 |
      10. |      FR   2010       5111          7          2       6       0.0   28.55307 |
          |------------------------------------------------------------------------------|
      11. |      FR   2010       5111          7          4      16       0.0   76.14153 |
      12. |      FR   2010       5111          5          2      32       0.0   152.2831 |
      13. |      FR   2010       5111          4          3      41       0.0   195.1127 |
      14. |      FR   2010       5111          3          1      65       0.1    309.325 |
      15. |      FR   2010       5111          7          1       5       0.0   23.79423 |
          |------------------------------------------------------------------------------|
      16. |      FR   2010       5111          8          3       7       0.0   33.31192 |
      17. |      FR   2010       5111          4          1      92       0.1   437.8138 |
      18. |      FR   2010       5111          3          2      67       0.1   318.8427 |
      19. |      FR   2010       5111          2          1      30       0.0   142.7654 |
      20. |      FR   2010       5111          6          1      33       0.0   157.0419 |
          |------------------------------------------------------------------------------|
      21. |      FR   2010       5111          8          4      10       0.0   47.58846 |
      22. |      FR   2010       5111          5          1      72       0.1   342.6369 |
      23. |      FR   2010       5111          1          2      25       0.0   118.9711 |
      24. |      FR   2010       5111          6          2      12       0.0   57.10614 |
      25. |      FR   2010       5111          5          4      39       0.0    185.595 |
          |------------------------------------------------------------------------------|
      26. |      FR   2010       5111          4          2      54       0.1   256.9777 |
      27. |      FR   2010       5111          4          4      66       0.1   314.0838 |
      28. |      FR   2010       5111          7          3       7       0.0   33.31192 |
      29. |      FR   2010       5111          6          3      11       0.0    52.3473 |
      30. |      FR   2010       5111          1          4      23       0.0   109.4535 |
          |------------------------------------------------------------------------------|
      31. |      FR   2010       5111          5          3      37       0.0   176.0773 |
      32. |      FR   2010       5111          2          4      47       0.0   223.6657 |
      33. |      FR   2011       5293          5          4      39       0.0   192.2039 |
      34. |      FR   2011       5293          7          4      16       0.0   78.85289 |
      35. |      FR   2011       5293          8          4      10       0.0   49.28305 |
          |------------------------------------------------------------------------------|
      36. |      FR   2011       5293          4          3      41       0.0   202.0605 |
      37. |      FR   2011       5293          8          3       7       0.0   34.49814 |
      38. |      FR   2011       5293          8          1       4       0.0   19.71322 |
      39. |      FR   2011       5293          5          2      32       0.0   157.7058 |
      40. |      FR   2011       5293          4          2      54       0.1   266.1285 |
          |------------------------------------------------------------------------------|
      41. |      FR   2011       5293          1          2      25       0.0   123.2076 |
      42. |      FR   2011       5293          7          3       7       0.0   34.49814 |
      43. |      FR   2011       5293          6          4      21       0.0   103.4944 |
      44. |      FR   2011       5293          8          2       7       0.0   34.49814 |
      45. |      FR   2011       5293          2          2      35       0.0   172.4907 |
          |------------------------------------------------------------------------------|
      46. |      FR   2011       5293          5          3      37       0.0   182.3473 |
      47. |      FR   2011       5293          3          1      65       0.1   320.3398 |
      48. |      FR   2011       5293          4          1      92       0.1   453.4041 |
      49. |      FR   2011       5293          4          4      66       0.1   325.2682 |
      50. |      FR   2011       5293          2          4      47       0.0   231.6303 |
          |------------------------------------------------------------------------------|
      51. |      FR   2011       5293          6          3      11       0.0   54.21136 |
      52. |      FR   2011       5293          2          3      41       0.0   202.0605 |
      53. |      FR   2011       5293          1          4      23       0.0    113.351 |
      54. |      FR   2011       5293          6          2      12       0.0   59.13966 |
      55. |      FR   2011       5293          3          4      76       0.1   374.5512 |
          |------------------------------------------------------------------------------|
      56. |      FR   2011       5293          3          3      46       0.0   226.7021 |
      57. |      FR   2011       5293          1          3      26       0.0   128.1359 |
      58. |      FR   2011       5293          5          1      72       0.1    354.838 |
      59. |      FR   2011       5293          7          1       5       0.0   24.64153 |
      60. |      FR   2011       5293          3          2      67       0.1   330.1965 |
          |------------------------------------------------------------------------------|
      61. |      FR   2011       5293          6          1      33       0.0   162.6341 |
      62. |      FR   2011       5293          2          1      30       0.0   147.8492 |
      63. |      FR   2011       5293          1          1      21       0.0   103.4944 |
      64. |      FR   2011       5293          7          2       6       0.0   29.56983 |
      65. |      FR   2012       5201          6          3      11       0.0   53.26909 |
          |------------------------------------------------------------------------------|
      66. |      FR   2012       5201          4          2      54       0.1   261.5028 |
      67. |      FR   2012       5201          7          1       5       0.0   24.21322 |
      68. |      FR   2012       5201          8          3       7       0.0   33.89851 |
      69. |      FR   2012       5201          7          4      16       0.0   77.48231 |
      70. |      FR   2012       5201          8          2       7       0.0   33.89851 |
          |------------------------------------------------------------------------------|
      71. |      FR   2012       5201          5          4      39       0.0   188.8631 |
      72. |      FR   2012       5201          6          4      21       0.0   101.6955 |
      73. |      FR   2012       5201          2          4      47       0.0   227.6043 |
      74. |      FR   2012       5201          3          1      65       0.1   314.7719 |
      75. |      FR   2012       5201          7          3       7       0.0   33.89851 |
          |------------------------------------------------------------------------------|
      76. |      FR   2012       5201          4          3      41       0.0   198.5484 |
      77. |      FR   2012       5201          7          2       6       0.0   29.05586 |
      78. |      FR   2012       5201          2          3      41       0.0   198.5484 |
      79. |      FR   2012       5201          4          4      66       0.1   319.6145 |
      80. |      FR   2012       5201          5          2      32       0.0   154.9646 |
          |------------------------------------------------------------------------------|
    As you can see, 5111* 0.0 = 123.73
    Probably, I made a mistake in my assumptions or .....
    Do you have any ideas what can be my mistake?


    Section B:
    The second part of my question:
    After obtaining "Predicted_no" in the previous section, I am going to divide it by the total number of workers in a given skill group at
    t-10. The question is what is t-10 and how can I do that?

    Any ideas or suggestions are appreciated.

    Cheers,
    Paris




  • #2
    Section A

    Unfortunately, the example you show for data set 2 does not include "FR", so it is not possible to replicate your problem.

    That said, I suspect that the problem arises only from the display format applied to IM_share. The listing is showing the values of IMshare only to one decimal place. But a substantial number of the values of IMshare in your data are smaller than 0.05, which means that, to one decimal place, they will appear to be zero. I think you need to change the display format of IMshare
    Code:
    format IMshare %6.5f
    and you will then be able to see a reasonable number of decimal places so that you can satisfy yourself that the value of Predicted_no is correct.

    Section B

    Well, you should check with wherever you are getting your directions from what t-10 refers to. My best guess is it means, for each observation in your data, use the total number of workers in its skill group from 10 years earlier.

    Your question is unclear, because there is no variable in the resulting data that gives the total number of workers in a given skill group at any time. All you have are total number of new arrivals in one year. But let me guess that you really mean total number of predicted immigrant workers in the skill group at time t-10. (And if this is wrong, once you find or create the actual variable for total number of workers, you can just substitute it for Predicted_no in this code.)
    Code:
    by Expgroup sk_rat_quartile (Year), sort: egen long total_workers = total(Predicted_no)
    egen long stratum = group(Country Expgroup sk_rat_quartile)
    xtset stratum Year
    gen wanted = Predicted_no/L10.total_workers

    Comment


    • #3
      Hi Prof, Thank you for the reply.

      Here is an example where you can replicate that
      Code:
      . list if Country== "BR"
      
            +------------------------------------------------------------------------------+
            | Country   Year   new_ar~e   Expgroup   sk_rat~e   share   IMshare   Predic~o |
            |------------------------------------------------------------------------------|
      2401. |      BR   2010     119195          3          3     810       0.0   5793.804 |
      2402. |      BR   2010     119195          1          1     473       0.0   3383.295 |
      2403. |      BR   2010     119195          8          1     184       0.0   1316.123 |
      2404. |      BR   2010     119195          6          2     377       0.0   2696.622 |
      2405. |      BR   2010     119195          7          1     406       0.0   2904.055 |
            |------------------------------------------------------------------------------|
      2406. |      BR   2010     119195          6          4     118       0.0   844.0356 |
      2407. |      BR   2010     119195          1          2     489       0.0   3497.741 |
      2408. |      BR   2010     119195          8          4      31       0.0   221.7382 |
      2409. |      BR   2010     119195          2          4     240       0.0   1716.683 |
      2410. |      BR   2010     119195          5          1    1003       0.1   7174.303 |
            |------------------------------------------------------------------------------|
      2411. |      BR   2010     119195          4          2     874       0.1   6251.586 |
      2412. |      BR   2010     119195          4          4     209       0.0   1494.944 |
      2413. |      BR   2010     119195          6          1     681       0.0   4871.087 |
      2414. |      BR   2010     119195          3          1    1797       0.1   12853.66 |
      2415. |      BR   2010     119195          4          3     499       0.0   3569.269 |
            |------------------------------------------------------------------------------|
      2416. |      BR   2010     119195          5          3     289       0.0   2067.172 |
      2417. |      BR   2010     119195          7          4      74       0.0   529.3105 |
      2418. |      BR   2010     119195          2          3     857       0.1   6129.988 |
      2419. |      BR   2010     119195          1          3     427       0.0   3054.265 |
      2420. |      BR   2010     119195          8          2      80       0.0   572.2275 |
            |------------------------------------------------------------------------------|
      2421. |      BR   2010     119195          7          2     191       0.0   1366.193 |
      2422. |      BR   2010     119195          2          2    1046       0.1   7481.875 |
      2423. |      BR   2010     119195          7          3      79       0.0   565.0747 |
      2424. |      BR   2010     119195          4          1    1519       0.1   10865.17 |
      2425. |      BR   2010     119195          6          3     161       0.0   1151.608 |
            |------------------------------------------------------------------------------|
      2426. |      BR   2010     119195          8          3      50       0.0   357.6422 |
      2427. |      BR   2010     119195          5          4     155       0.0   1108.691 |
      2428. |      BR   2010     119195          2          1    1354       0.1   9684.951 |
      2429. |      BR   2010     119195          1          4      84       0.0   600.8389 |
      2430. |      BR   2010     119195          3          4     262       0.0   1874.045 |
            |------------------------------------------------------------------------------|
      2431. |      BR   2010     119195          3          2    1243       0.1   8890.985 |
      2432. |      BR   2010     119195          5          2     602       0.0   4306.012 |
      2433. |      BR   2011     111295          5          3     289       0.0   1930.164 |
      2434. |      BR   2011     111295          2          3     857       0.1   5723.705 |
      2435. |      BR   2011     111295          6          3     161       0.0   1075.282 |
            |------------------------------------------------------------------------------|
      2436. |      BR   2011     111295          7          2     191       0.0   1275.645 |
      2437. |      BR   2011     111295          2          4     240       0.0   1602.905 |
      2438. |      BR   2011     111295          5          2     602       0.0   4020.619 |
      2439. |      BR   2011     111295          8          3      50       0.0   333.9384 |
      2440. |      BR   2011     111295          8          2      80       0.0   534.3015 |
            |------------------------------------------------------------------------------|
      2441. |      BR   2011     111295          1          1     473       0.0   3159.058 |
      2442. |      BR   2011     111295          2          1    1354       0.1   9043.053 |
      2443. |      BR   2011     111295          8          4      31       0.0   207.0418 |
      2444. |      BR   2011     111295          3          3     810       0.0   5409.803 |
      2445. |      BR   2011     111295          1          4      84       0.0   561.0166 |
            |------------------------------------------------------------------------------|
      2446. |      BR   2011     111295          3          1    1797       0.1   12001.75 |
      2447. |      BR   2011     111295          6          4     118       0.0   788.0947 |
      2448. |      BR   2011     111295          3          2    1243       0.1   8301.709 |
      2449. |      BR   2011     111295          6          2     377       0.0   2517.896 |
      2450. |      BR   2011     111295          4          4     209       0.0   1395.863 |
            |------------------------------------------------------------------------------|
      2451. |      BR   2011     111295          6          1     681       0.0   4548.241 |
      2452. |      BR   2011     111295          7          1     406       0.0    2711.58 |
      2453. |      BR   2011     111295          7          3      79       0.0   527.6227 |
      2454. |      BR   2011     111295          1          3     427       0.0   2851.834 |
      2455. |      BR   2011     111295          5          4     155       0.0   1035.209 |
            |------------------------------------------------------------------------------|
      2456. |      BR   2011     111295          4          3     499       0.0   3332.706 |
      2457. |      BR   2011     111295          8          1     184       0.0   1228.893 |
      2458. |      BR   2011     111295          2          2    1046       0.1   6985.992 |
      2459. |      BR   2011     111295          3          4     262       0.0   1749.837 |
      2460. |      BR   2011     111295          4          2     874       0.1   5837.244 |
            |------------------------------------------------------------------------------|
      2461. |      BR   2011     111295          5          1    1003       0.1   6698.805 |
      2462. |      BR   2011     111295          1          2     489       0.0   3265.918 |
      2463. |      BR   2011     111295          7          4      74       0.0   494.2289 |
      2464. |      BR   2011     111295          4          1    1519       0.1   10145.05 |
      2465. |      BR   2012     105518          7          3      79       0.0   500.2354 |
            |------------------------------------------------------------------------------|
      2466. |      BR   2012     105518          5          4     155       0.0   981.4744 |
      2467. |      BR   2012     105518          8          2      80       0.0   506.5674 |
      2468. |      BR   2012     105518          2          1    1354       0.1   8573.654 |
      2469. |      BR   2012     105518          8          3      50       0.0   316.6047 |
      2470. |      BR   2012     105518          4          4     209       0.0   1323.407 |
            |------------------------------------------------------------------------------|
      2471. |      BR   2012     105518          5          3     289       0.0   1829.975 |
      2472. |      BR   2012     105518          2          3     857       0.1   5426.604 |
      2473. |      BR   2012     105518          7          1     406       0.0    2570.83 |
      2474. |      BR   2012     105518          3          4     262       0.0   1659.008 |
      2475. |      BR   2012     105518          6          3     161       0.0   1019.467 |
            |------------------------------------------------------------------------------|
      2476. |      BR   2012     105518          3          2    1243       0.1   7870.792 |
      2477. |      BR   2012     105518          6          4     118       0.0    747.187 |
      2478. |      BR   2012     105518          6          1     681       0.0   4312.155 |
      2479. |      BR   2012     105518          4          2     874       0.1    5534.25 |
      2480. |      BR   2012     105518          7          2     191       0.0    1209.43 |
            |------------------------------------------------------------------------------|
      2481. |      BR   2012     105518          8          4      31       0.0   196.2949 |
      2482. |      BR   2012     105518          7          4      74       0.0   468.5749 |
      2483. |      BR   2012     105518          1          3     427       0.0   2703.804 |
      2484. |      BR   2012     105518          4          1    1519       0.1   9618.449 |
      2485. |      BR   2012     105518          5          2     602       0.0    3811.92 |
            |------------------------------------------------------------------------------|
      2486. |      BR   2012     105518          8          1     184       0.0   1165.105 |
      2487. |      BR   2012     105518          2          4     240       0.0   1519.702 |
      2488. |      BR   2012     105518          3          1    1797       0.1   11378.77 |
      2489. |      BR   2012     105518          1          2     489       0.0   3096.394 |
      2490. |      BR   2012     105518          1          1     473       0.0    2995.08 |
            |------------------------------------------------------------------------------|
      2491. |      BR   2012     105518          5          1    1003       0.1   6351.089 |
      2492. |      BR   2012     105518          6          2     377       0.0   2387.199 |
      2493. |      BR   2012     105518          4          3     499       0.0   3159.714 |
      2494. |      BR   2012     105518          2          2    1046       0.1    6623.37 |
      2495. |      BR   2012     105518          1          4      84       0.0   531.8958 |
            |------------------------------------------------------------------------------|
      2496. |      BR   2012     105518          3          3     810       0.0   5128.996 |
      2497. |      BR   2013      91238          5          1    1003       0.1   5491.582 |
      2498. |      BR   2013      91238          1          2     489       0.0   2677.351 |
      2499. |      BR   2013      91238          4          4     209       0.0   1144.308 |
      2500. |      BR   2013      91238          5          3     289       0.0    1582.32 |
            |------------------------------------------------------------------------------|
      2501. |      BR   2013      91238          7          4      74       0.0   405.1615 |
      2502. |      BR   2013      91238          5          4     155       0.0   848.6492 |
      2503. |      BR   2013      91238          1          1     473       0.0   2589.749 |
      2504. |      BR   2013      91238          2          2    1046       0.1   5727.014 |
      2505. |      BR   2013      91238          6          4     118       0.0   646.0684 |
            |------------------------------------------------------------------------------|
      2506. |      BR   2013      91238          2          4     240       0.0   1314.037 |
      2507. |      BR   2013      91238          8          4      31       0.0   169.7298 |
      2508. |      BR   2013      91238          8          2      80       0.0   438.0125 |
      2509. |      BR   2013      91238          8          3      50       0.0   273.7578 |
      2510. |      BR   2013      91238          6          1     681       0.0   3728.581 |
            |------------------------------------------------------------------------------|
      2511. |      BR   2013      91238          4          1    1519       0.1   8316.762 |
      2512. |      BR   2013      91238          3          4     262       0.0   1434.491 |
      2513. |      BR   2013      91238          2          3     857       0.1   4692.208 |
      2514. |      BR   2013      91238          7          2     191       0.0   1045.755 |
      2515. |      BR   2013      91238          3          1    1797       0.1   9838.855 |
            |------------------------------------------------------------------------------|
      2516. |      BR   2013      91238          1          4      84       0.0   459.9131 |
      2517. |      BR   2013      91238          4          3     499       0.0   2732.103 |
      2518. |      BR   2013      91238          1          3     427       0.0   2337.892 |
      2519. |      BR   2013      91238          8          1     184       0.0   1007.429 |
      2520. |      BR   2013      91238          6          2     377       0.0   2064.134 |
            |------------------------------------------------------------------------------|
      2521. |      BR   2013      91238          3          3     810       0.0   4434.876 |
      2522. |      BR   2013      91238          5          2     602       0.0   3296.044 |
      2523. |      BR   2013      91238          7          3      79       0.0   432.5373 |
      2524. |      BR   2013      91238          6          3     161       0.0   881.5001 |
      2525. |      BR   2013      91238          3          2    1243       0.1   6805.619 |
            |------------------------------------------------------------------------------|
      2526. |      BR   2013      91238          2          1    1354       0.1   7413.361 |
      2527. |      BR   2013      91238          4          2     874       0.1   4785.287 |
      2528. |      BR   2013      91238          7          1     406       0.0   2222.913 |
      2529. |      BR   2014      85288          3          1    1797       0.1   9197.224 |
      2530. |      BR   2014      85288          7          1     406       0.0   2077.948 |
            |------------------------------------------------------------------------------|
      2531. |      BR   2014      85288          3          3     810       0.0    4145.66 |
      2532. |      BR   2014      85288          4          3     499       0.0   2553.931 |
      2533. |      BR   2014      85288          5          3     289       0.0    1479.13 |
      2534. |      BR   2014      85288          7          4      74       0.0   378.7393 |
      2535. |      BR   2014      85288          2          1    1354       0.1   6929.906 |
            |------------------------------------------------------------------------------|
      2536. |      BR   2014      85288          2          3     857       0.1   4386.211 |
      2537. |      BR   2014      85288          2          2    1046       0.1   5353.532 |
      2538. |      BR   2014      85288          6          4     118       0.0   603.9357 |
      2539. |      BR   2014      85288          1          1     473       0.0   2420.861 |
      2540. |      BR   2014      85288          2          4     240       0.0   1228.344 |
            |------------------------------------------------------------------------------|
      2541. |      BR   2014      85288          6          1     681       0.0   3485.425 |
      2542. |      BR   2014      85288          5          2     602       0.0   3081.095 |
      2543. |      BR   2014      85288          7          2     191       0.0   977.5569 |
      2544. |      BR   2014      85288          8          4      31       0.0   158.6611 |
      2545. |      BR   2014      85288          1          2     489       0.0    2502.75 |
            |------------------------------------------------------------------------------|
      2546. |      BR   2014      85288          8          2      80       0.0   409.4479 |
      2547. |      BR   2014      85288          1          4      84       0.0   429.9203 |
      2548. |      BR   2014      85288          3          2    1243       0.1   6361.797 |
      2549. |      BR   2014      85288          5          1    1003       0.1   5133.453 |
      2550. |      BR   2014      85288          8          3      50       0.0    255.905 |
            |------------------------------------------------------------------------------|
      2551. |      BR   2014      85288          4          4     209       0.0   1069.683 |
      2552. |      BR   2014      85288          1          3     427       0.0   2185.428 |
      2553. |      BR   2014      85288          8          1     184       0.0   941.7302 |
      2554. |      BR   2014      85288          4          2     874       0.1   4473.218 |
      2555. |      BR   2014      85288          3          4     262       0.0   1340.942 |
            |------------------------------------------------------------------------------|
      2556. |      BR   2014      85288          4          1    1519       0.1   7774.392 |
      2557. |      BR   2014      85288          6          2     377       0.0   1929.523 |
      2558. |      BR   2014      85288          6          3     161       0.0   824.0139 |
      2559. |      BR   2014      85288          5          4     155       0.0   793.3054 |
      2560. |      BR   2014      85288          7          3      79       0.0   404.3298 |
            |------------------------------------------------------------------------------|
      2561. |      BR   2015      80515          4          4     209       0.0    1009.82 |
      2562. |      BR   2015      80515          4          1    1519       0.1   7339.311 |
      2563. |      BR   2015      80515          5          1    1003       0.1   4846.168 |
      2564. |      BR   2015      80515          8          4      31       0.0   149.7819 |
      2565. |      BR   2015      80515          4          3     499       0.0   2411.005 |
            |------------------------------------------------------------------------------|
      2566. |      BR   2015      80515          3          1    1797       0.1   8682.517 |
      2567. |      BR   2015      80515          4          2     874       0.1   4222.882 |
      2568. |      BR   2015      80515          3          2    1243       0.1    6005.77 |
      2569. |      BR   2015      80515          5          3     289       0.0   1396.354 |
      2570. |      BR   2015      80515          6          4     118       0.0   570.1374 |
            |------------------------------------------------------------------------------|
      2571. |      BR   2015      80515          1          4      84       0.0   405.8606 |
      2572. |      BR   2015      80515          2          3     857       0.1   4140.744 |
      2573. |      BR   2015      80515          3          4     262       0.0   1265.898 |
      2574. |      BR   2015      80515          7          4      74       0.0   357.5438 |
      2575. |      BR   2015      80515          7          2     191       0.0   922.8495 |
            |------------------------------------------------------------------------------|
      2576. |      BR   2015      80515          8          3      50       0.0   241.5837 |
      2577. |      BR   2015      80515          5          2     602       0.0   2908.667 |
      2578. |      BR   2015      80515          8          1     184       0.0   889.0279 |
      2579. |      BR   2015      80515          1          1     473       0.0   2285.381 |
      2580. |      BR   2015      80515          7          3      79       0.0   381.7021 |
            |------------------------------------------------------------------------------|
      2581. |      BR   2015      80515          6          3     161       0.0   777.8994 |
      2582. |      BR   2015      80515          8          2      80       0.0   386.5338 |
      2583. |      BR   2015      80515          2          4     240       0.0   1159.602 |
      2584. |      BR   2015      80515          1          2     489       0.0   2362.688 |
      2585. |      BR   2015      80515          7          1     406       0.0   1961.659 |
            |------------------------------------------------------------------------------|
      2586. |      BR   2015      80515          3          3     810       0.0   3913.655 |
      2587. |      BR   2015      80515          5          4     155       0.0   748.9093 |
      2588. |      BR   2015      80515          6          1     681       0.0   3290.369 |
      2589. |      BR   2015      80515          2          1    1354       0.1   6542.085 |
      2590. |      BR   2015      80515          1          3     427       0.0   2063.125 |
            |------------------------------------------------------------------------------|
      2591. |      BR   2015      80515          2          2    1046       0.1    5053.93 |
      2592. |      BR   2015      80515          6          2     377       0.0   1821.541 |
      2593. |      BR   2016      79569          4          1    1519       0.1   7253.079 |
      2594. |      BR   2016      79569          3          3     810       0.0   3867.672 |
      2595. |      BR   2016      79569          5          2     602       0.0   2874.492 |
            |------------------------------------------------------------------------------|
      2596. |      BR   2016      79569          5          3     289       0.0   1379.947 |
      2597. |      BR   2016      79569          2          1    1354       0.1    6465.22 |
      2598. |      BR   2016      79569          8          3      50       0.0   238.7452 |
      2599. |      BR   2016      79569          2          2    1046       0.1    4994.55 |
      2600. |      BR   2016      79569          4          4     209       0.0   997.9549 |
            |------------------------------------------------------------------------------|
      2601. |      BR   2016      79569          4          2     874       0.1   4173.266 |
      2602. |      BR   2016      79569          1          4      84       0.0   401.0919 |
      2603. |      BR   2016      79569          8          2      80       0.0   381.9923 |
      2604. |      BR   2016      79569          8          1     184       0.0   878.5823 |
      2605. |      BR   2016      79569          6          3     161       0.0   768.7595 |
            |------------------------------------------------------------------------------|
      2606. |      BR   2016      79569          6          1     681       0.0    3251.71 |
      2607. |      BR   2016      79569          1          2     489       0.0   2334.928 |
      2608. |      BR   2016      79569          2          3     857       0.1   4092.093 |
      2609. |      BR   2016      79569          7          1     406       0.0   1938.611 |
      2610. |      BR   2016      79569          1          1     473       0.0    2258.53 |
            |------------------------------------------------------------------------------|
      2611. |      BR   2016      79569          3          2    1243       0.1   5935.206 |
      2612. |      BR   2016      79569          4          3     499       0.0   2382.677 |
      2613. |      BR   2016      79569          8          4      31       0.0    148.022 |
      2614. |      BR   2016      79569          7          3      79       0.0   377.2174 |
      2615. |      BR   2016      79569          5          4     155       0.0   740.1101 |

      Comment


      • #4
        Sorry, but what you show is not -dataex- output, it is -list- output and it will take a lot of "surgery" to import it into Stata. Also, the code would not be testable in the example you show because the years only range between 2010 and 2016, so there is no case where data from 10 years earlier is included.

        Also, it is still unclear what variable represents "total workers" here. There is a new variable, share, shown this time. Is that it? It doesn't sound like it from the name, but, perhaps that's why you added it in this time around?

        Comment


        • #5
          Originally posted by Clyde Schechter View Post
          Section A
          Code:
          format IMshare %6.5f
          It has been solved. The question was pretty long and complicated but you figure it out perfectly.
          All my thanks Prof Clyde.

          Comment


          • #6
            Originally posted by Clyde Schechter View Post

            Also, it is still unclear what variable represents "total workers" here. There is a new variable, share, shown this time. Is that it?

            I did not share it yet. I just expressed the situation to understand t-10. Now I understood what should I do.


            Actually, the problem was with
            format IMshare as you guessed correctly. After correcting that, the issue has been solved. Thanks a lot.

            Comment

            Working...
            X