Announcement

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

  • Calculating population growth in thousands of inhabitants

    Hello Stata people;

    I'm using Stata version 13.1, and I have this data:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int Year long Population
    1960 354531754
    1961 357404302
    1962 360431043
    1963 364153147
    1964 367355615
    1965 370521157
    1966 373443503
    1967 376321214
    1968 379076041
    1969 381626236
    1970 384326562
    1971 385949080
    1972 388592631
    1973 391211759
    1974 393658199
    1975 395835667
    1976 398037111
    1977 399967581
    1978 401903104
    1979 403662165
    1980 405466907
    1981 407369042
    1982 408894651
    1983 410107692
    1984 411006427
    1985 411907502
    1986 412876239
    1987 414088076
    1988 415218942
    1989 416715205
    1990 418030739
    1991 419504036
    1992 420413536
    1993 421912578
    1994 423104986
    1995 423960534
    1996 424641798
    1997 425273491
    1998 427482962
    1999 427998269
    2000 428473834
    2001 429240746
    2002 429728905
    2003 431246056
    2004 432878129
    2005 434585887
    2006 436041018
    2007 437514477
    2008 439074280
    2009 440467898
    2010 441160594
    2011 440526112
    2012 441280191
    2013 441739935
    2014 442268078
    2015 442924865
    2016 444003268
    2017 444670605
    2018 445301376
    2019 446149924
    2020 447030024
    2021 445891011
    2022 445997083
    2023 447704445
    2024 449309618
    2025 450380320
    end
    format %ty Year
    As you can see, it shows the annual aggregated population of 27 European countries. My goal is to generate a variable that shows the change (evolution, variation, growth or degrowth) of that population in numbers (thousands of inhabitants), in order to draw a yealy annual graph of that variable, it is kind of like the population growth, but in thousands, not in percentage.

    Can I get some help with this?

    With many thanks!

  • #2
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int Year long Population
    1960 354531754
    1961 357404302
    1962 360431043
    1963 364153147
    1964 367355615
    1965 370521157
    1966 373443503
    1967 376321214
    1968 379076041
    1969 381626236
    1970 384326562
    1971 385949080
    1972 388592631
    1973 391211759
    1974 393658199
    1975 395835667
    1976 398037111
    1977 399967581
    1978 401903104
    1979 403662165
    1980 405466907
    1981 407369042
    1982 408894651
    1983 410107692
    1984 411006427
    1985 411907502
    1986 412876239
    1987 414088076
    1988 415218942
    1989 416715205
    1990 418030739
    1991 419504036
    1992 420413536
    1993 421912578
    1994 423104986
    1995 423960534
    1996 424641798
    1997 425273491
    1998 427482962
    1999 427998269
    2000 428473834
    2001 429240746
    2002 429728905
    2003 431246056
    2004 432878129
    2005 434585887
    2006 436041018
    2007 437514477
    2008 439074280
    2009 440467898
    2010 441160594
    2011 440526112
    2012 441280191
    2013 441739935
    2014 442268078
    2015 442924865
    2016 444003268
    2017 444670605
    2018 445301376
    2019 446149924
    2020 447030024
    2021 445891011
    2022 445997083
    2023 447704445
    2024 449309618
    2025 450380320
    end
    format %ty Year
    
    tsset Year 
    gen long growth = D.Population
    gen growth2 = growth / 1000 
    
    list 
    
    
         +-----------------------------------------+
         | Year   Populat~n     growth     growth2 |
         |-----------------------------------------|
      1. | 1960   354531754          .           . |
      2. | 1961   357404302    2872548    2872.548 |
      3. | 1962   360431043    3026741    3026.741 |
      4. | 1963   364153147    3722104    3722.104 |
      5. | 1964   367355615    3202468    3202.468 |
         |-----------------------------------------|
      6. | 1965   370521157    3165542    3165.542 |
      7. | 1966   373443503    2922346    2922.346 |
      8. | 1967   376321214    2877711    2877.711 |
      9. | 1968   379076041    2754827    2754.827 |
     10. | 1969   381626236    2550195    2550.195 |
         |-----------------------------------------|
     11. | 1970   384326562    2700326    2700.326 |
     12. | 1971   385949080    1622518    1622.518 |
     13. | 1972   388592631    2643551    2643.551 |
     14. | 1973   391211759    2619128    2619.128 |
     15. | 1974   393658199    2446440     2446.44 |
         |-----------------------------------------|
     16. | 1975   395835667    2177468    2177.468 |
     17. | 1976   398037111    2201444    2201.444 |
     18. | 1977   399967581    1930470     1930.47 |
     19. | 1978   401903104    1935523    1935.523 |
     20. | 1979   403662165    1759061    1759.061 |
         |-----------------------------------------|
     21. | 1980   405466907    1804742    1804.742 |
     22. | 1981   407369042    1902135    1902.135 |
     23. | 1982   408894651    1525609    1525.609 |
     24. | 1983   410107692    1213041    1213.041 |
     25. | 1984   411006427     898735     898.735 |
         |-----------------------------------------|
     26. | 1985   411907502     901075     901.075 |
     27. | 1986   412876239     968737     968.737 |
     28. | 1987   414088076    1211837    1211.837 |
     29. | 1988   415218942    1130866    1130.866 |
     30. | 1989   416715205    1496263    1496.263 |
         |-----------------------------------------|
     31. | 1990   418030739    1315534    1315.534 |
     32. | 1991   419504036    1473297    1473.297 |
     33. | 1992   420413536     909500       909.5 |
     34. | 1993   421912578    1499042    1499.042 |
     35. | 1994   423104986    1192408    1192.408 |
         |-----------------------------------------|
     36. | 1995   423960534     855548     855.548 |
     37. | 1996   424641798     681264     681.264 |
     38. | 1997   425273491     631693     631.693 |
     39. | 1998   427482962    2209471    2209.471 |
     40. | 1999   427998269     515307     515.307 |
         |-----------------------------------------|
     41. | 2000   428473834     475565     475.565 |
     42. | 2001   429240746     766912     766.912 |
     43. | 2002   429728905     488159     488.159 |
     44. | 2003   431246056    1517151    1517.151 |
     45. | 2004   432878129    1632073    1632.073 |
         |-----------------------------------------|
     46. | 2005   434585887    1707758    1707.758 |
     47. | 2006   436041018    1455131    1455.131 |
     48. | 2007   437514477    1473459    1473.459 |
     49. | 2008   439074280    1559803    1559.803 |
     50. | 2009   440467898    1393618    1393.618 |
         |-----------------------------------------|
     51. | 2010   441160594     692696     692.696 |
     52. | 2011   440526112    -634482    -634.482 |
     53. | 2012   441280191     754079     754.079 |
     54. | 2013   441739935     459744     459.744 |
     55. | 2014   442268078     528143     528.143 |
         |-----------------------------------------|
     56. | 2015   442924865     656787     656.787 |
     57. | 2016   444003268    1078403    1078.403 |
     58. | 2017   444670605     667337     667.337 |
     59. | 2018   445301376     630771     630.771 |
     60. | 2019   446149924     848548     848.548 |
         |-----------------------------------------|
     61. | 2020   447030024     880100       880.1 |
     62. | 2021   445891011   -1139013   -1139.013 |
     63. | 2022   445997083     106072     106.072 |
     64. | 2023   447704445    1707362    1707.362 |
     65. | 2024   449309618    1605173    1605.173 |
         |-----------------------------------------|
     66. | 2025   450380320    1070702    1070.702 |
         +-----------------------------------------+

    Comment


    • #3
      Nick Cox Thank you! It worked.

      Comment

      Working...
      X