Armed forces personnel (% of total labor force)

Source: worldbank.org, 03.09.2025

Year: 2020

Flag Country Value Value change, % Rank
Afghanistan Afghanistan 1.82 -39.8% 32
Angola Angola 0.851 -3% 81
Albania Albania 0.592 +4.69% 100
United Arab Emirates United Arab Emirates 1.02 +1.27% 65
Argentina Argentina 0.533 +6.54% 111
Armenia Armenia 3.18 -3.1% 15
Australia Australia 0.441 +1.72% 122
Austria Austria 0.499 +5% 115
Azerbaijan Azerbaijan 1.58 -3.84% 39
Burundi Burundi 0.59 -40.5% 101
Belgium Belgium 0.468 -7.31% 120
Benin Benin 0.214 -2.61% 153
Burkina Faso Burkina Faso 0.178 +1.91% 155
Bangladesh Bangladesh 0.322 -1.7% 143
Bulgaria Bulgaria 1.18 +2.55% 54
Bahrain Bahrain 2.32 +3.41% 22
Bahamas Bahamas 0.917 +5.5% 75
Bosnia & Herzegovina Bosnia & Herzegovina 0.791 +2.32% 87
Belarus Belarus 3.17 +2.82% 16
Belize Belize 1.12 +6.02% 59
Bolivia Bolivia 1.2 +0.117% 53
Brazil Brazil 0.762 +6.26% 89
Barbados Barbados 0.679 +1.32% 94
Brunei Brunei 3.56 -0.329% 12
Botswana Botswana 0.918 +0.76% 74
Central African Republic Central African Republic 0.533 -0.898% 110
Canada Canada 0.351 +1.43% 138
Switzerland Switzerland 0.401 -0.209% 130
Chile Chile 1.28 +3.27% 51
China China 0.332 +1.58% 142
Côte d’Ivoire Côte d’Ivoire 0.248 -80.5% 148
Cameroon Cameroon 0.343 -0.773% 140
Congo - Kinshasa Congo - Kinshasa 0.408 +0.926% 129
Congo - Brazzaville Congo - Brazzaville 0.536 109
Colombia Colombia 1.7 -11.6% 35
Cape Verde Cape Verde 0.493 +4.33% 117
Costa Rica Costa Rica 0.413 +4.75% 125
Cuba Cuba 1.57 +5.91% 40
Cyprus Cyprus 1.81 -19.2% 33
Czechia Czechia 0.505 +9.05% 114
Germany Germany 0.422 +0.853% 123
Djibouti Djibouti 5.48 -0.00337% 3
Denmark Denmark 0.495 +0.0761% 116
Dominican Republic Dominican Republic 1.48 +6.48% 42
Algeria Algeria 2.71 +8.13% 18
Ecuador Ecuador 0.543 +8.45% 107
Egypt Egypt 2.76 -0.635% 17
Eritrea Eritrea 13.4 -1.24% 1
Spain Spain 0.868 +1.36% 79
Estonia Estonia 1 -0.000143% 69
Ethiopia Ethiopia 0.281 -0.327% 146
Finland Finland 0.802 -18.4% 86
Fiji Fiji 1.07 +0.669% 60
France France 1 +0.696% 68
Gabon Gabon 0.995 +4.61% 70
United Kingdom United Kingdom 0.447 +2.53% 121
Georgia Georgia 1.39 -0.563% 45
Ghana Ghana 0.124 -0.387% 158
Guinea Guinea 0.321 -2.03% 144
Gambia Gambia 0.573 -3.15% 104
Guinea-Bissau Guinea-Bissau 0.537 -1.97% 108
Equatorial Guinea Equatorial Guinea 0.163 +2.88% 156
Greece Greece 3.2 +1.67% 14
Guatemala Guatemala 0.658 +1.62% 98
Guyana Guyana 1.04 +1.54% 64
Honduras Honduras 0.556 +4.57% 105
Croatia Croatia 1.17 +12% 56
Haiti Haiti 0.0202 -0.776% 165
Hungary Hungary 0.952 +15.3% 71
Indonesia Indonesia 0.492 +0.0365% 118
India India 0.576 +0.539% 103
Ireland Ireland 0.366 +0.327% 135
Iran Iran 2.35 +5.44% 21
Iraq Iraq 4.46 +36.6% 6
Iceland Iceland 0 166
Israel Israel 4.23 +0.59% 8
Italy Italy 1.35 +1.82% 46
Jamaica Jamaica 0.412 +2.29% 126
Jordan Jordan 3.98 -4.15% 10
Japan Japan 0.38 +0.227% 131
Kazakhstan Kazakhstan 0.723 +0.955% 91
Kenya Kenya 0.113 -18.7% 160
Kyrgyzstan Kyrgyzstan 0.718 -2.38% 92
Cambodia Cambodia 2.01 -1.59% 25
South Korea South Korea 2.01 -6.55% 26
Kuwait Kuwait 1.04 +7.58% 63
Laos Laos 4.09 -3% 9
Lebanon Lebanon 4.31 +9.93% 7
Liberia Liberia 0.0871 -1.69% 163
Libya Libya 0 166
Sri Lanka Sri Lanka 3.74 +2.5% 11
Lesotho Lesotho 0.244 -0.586% 149
Lithuania Lithuania 2.48 -0.908% 20
Luxembourg Luxembourg 0.314 -1.71% 145
Latvia Latvia 0.916 +50% 76
Morocco Morocco 2.06 +1.8% 24
Moldova Moldova 0.408 +0.867% 127
Madagascar Madagascar 0.151 -2% 157
Mexico Mexico 0.644 +11.1% 99
North Macedonia North Macedonia 2 +2.82% 28
Mali Mali 0.544 +97.5% 106
Malta Malta 0.723 -4.15% 90
Myanmar (Burma) Myanmar (Burma) 1.94 -10.1% 30
Montenegro Montenegro 4.66 +8.36% 5
Mongolia Mongolia 1.3 +2.61% 50
Mozambique Mozambique 0.0833 -2.17% 164
Mauritania Mauritania 2 -2.24% 27
Mauritius Mauritius 0.505 +5.93% 113
Malawi Malawi 0.198 -4.82% 154
Malaysia Malaysia 0.806 -1.43% 85
Namibia Namibia 1.61 -0.847% 37
Niger Niger 0.112 -2.89% 161
Nigeria Nigeria 0.224 -3.02% 152
Nicaragua Nicaragua 0.408 -0.817% 128
Netherlands Netherlands 0.419 -0.497% 124
Norway Norway 0.864 +7.98% 80
Nepal Nepal 1.4 -2.19% 44
New Zealand New Zealand 0.347 +8.97% 139
Oman Oman 2.13 +10.3% 23
Pakistan Pakistan 1.25 -2.24% 52
Panama Panama 1.33 +1.28% 48
Peru Peru 0.937 +10.3% 73
Philippines Philippines 0.369 +7.8% 133
Papua New Guinea Papua New Guinea 0.123 -2.26% 159
Poland Poland 1.04 +1.41% 62
North Korea North Korea 8.59 +1.11% 2
Portugal Portugal 1.01 +2.15% 67
Paraguay Paraguay 0.884 +1.62% 77
Palestinian Territories Palestinian Territories 0 166
Qatar Qatar 1.07 -4.27% 61
Romania Romania 1.52 +2.3% 41
Russia Russia 1.98 +0.681% 29
Rwanda Rwanda 0.703 -9.54% 93
Saudi Arabia Saudi Arabia 1.92 +4.19% 31
Sudan Sudan 1.34 +16.2% 47
Senegal Senegal 0.378 -2.53% 132
Singapore Singapore 1.72 +0.668% 34
Sierra Leone Sierra Leone 0.355 -1.98% 137
El Salvador El Salvador 1.61 +4.83% 38
Somalia Somalia 0.471 -32.1% 119
Serbia Serbia 1.01 +1.98% 66
South Sudan South Sudan 1.18 -72.4% 55
Suriname Suriname 0.834 +3.58% 84
Slovakia Slovakia 0.665 +13.7% 97
Slovenia Slovenia 0.679 +0.352% 95
Sweden Sweden 0.274 -0.125% 147
Syria Syria 5.19 -4.64% 4
Chad Chad 0.846 -2.5% 82
Togo Togo 0.339 -1.76% 141
Thailand Thailand 1.13 -0.746% 58
Tajikistan Tajikistan 0.675 -1.12% 96
Turkmenistan Turkmenistan 2.56 +37.2% 19
Timor-Leste Timor-Leste 0.358 -1.96% 136
Trinidad & Tobago Trinidad & Tobago 0.768 +3.17% 88
Tunisia Tunisia 1.14 +4.84% 57
Turkey Turkey 1.61 +6.03% 36
Tanzania Tanzania 0.101 +0.739% 162
Uganda Uganda 0.24 -5.95% 151
Ukraine Ukraine 1.43 -1.53% 43
Uruguay Uruguay 1.32 +3.45% 49
United States United States 0.838 +1.93% 83
Uzbekistan Uzbekistan 0.519 +0.362% 112
Venezuela Venezuela 3.22 +7.84% 13
Vietnam Vietnam 0.947 +1.87% 72
Yemen Yemen 0.581 -2.18% 102
South Africa South Africa 0.368 +3.13% 134
Zambia Zambia 0.243 -5.7% 150
Zimbabwe Zimbabwe 0.877 -0.698% 78

The indicator 'Armed Forces Personnel (% of Total Labor Force)' reflects the proportion of individuals serving in the military relative to the overall workforce of a nation. This metric not only provides insight into a country’s defense posture but also offers a glimpse into the socio-economic structure and priorities of a nation.

Understanding the importance of this indicator is crucial. Countries with a high percentage of armed forces personnel often face unique challenges and circumstances that shape their national policies and social dynamics. A high percentage may suggest a country in a state of conflict or a regime with a powerful military influence in society, as seen in nations like Eritrea and North Korea, where the figures rose to 13.35% and 9.5%, respectively. In contrast, countries like Iceland and Libya show a 0% representation, highlighting their distinct political environments focused more on peace and less on military engagement.

The median value of 0.83% in the year 2020 serves as a reference point. This figure indicates that under 1% of the labor force globally comprises military personnel, suggesting that, for most countries, the military does not dominate the labor market. This can be interpreted as a reflection of stability, peacetime economies, and the diversification of human resources into various sectors such as technology and services.

The connection between armed forces personnel and other socio-economic indicators is profound. For instance, nations with higher military engagement often have lower levels of civilian employment in other sectors. This can be attributed to the prioritization of national defense needs over civilian economic development. Furthermore, a significant military presence can skew resource allocation, affecting education and healthcare systems negatively, as funds may be redirected to maintain military strengths. Conversely, nations with minimal military involvement often exhibit robust civilian economies, strong education systems, and high life satisfaction indices.

Several factors affect the percentage of armed forces personnel within the labor force. Geopolitical tensions, historical conflicts, and governmental policies play crucial roles. Countries experiencing ongoing conflict or with significant territorial disputes, such as Syria and Iraq, have a higher military proportion. Alternatively, those prioritizing diplomacy and international cooperation tend to maintain lower military numbers. Economic conditions also impact this indicator; countries struggling economically may enlist more individuals in armed forces either as a means of employment or to strengthen national security amidst turmoil.

Strategies to address the implications of having a high percentage of military personnel can vary. For nations with a sizable military workforce, transitioning toward civilian employment could involve investing in retraining and education for service members as they integrate back into civilian life. This would help mitigate the potential negative impacts of high military labor force percentages, allowing for better resource management and economic diversification.

However, these strategies come with flaws. The transition from military to civilian life can be challenging, with service members facing societal reintegration issues, including trauma and a lack of transferable skills. Furthermore, the political influence of military forces in governance could hinder efforts toward diminishing military labor force numbers. In societies where the military plays a dominant role in government functions, transitioning away from a militarized economy could be fraught with obstacles.

Analyzing historical data provides valuable insights into trends. In the years between 1991 and 2020, the percentage of armed forces personnel consistently decreased from 1.03% to 0.79%. This decline suggests a gradual movement toward globally recognizing the importance of fostering diversified economies and minimizing reliance on military personnel. The decline could also represent a shift in focus towards peaceful initiatives and international cooperation, as nations increasingly prioritize diplomatic solutions over military engagement.

In conclusion, the 'Armed Forces Personnel (% of Total Labor Force)' indicator serves as a multifaceted measure that reflects broader socio-economic conditions and national priorities. Addressing the implications of high military labor force percentages requires strategic planning, resource allocation, and a commitment to re-integrating military personnel into civilian sectors effectively. While historical trends indicate a global decline in military proportions, ongoing geopolitical factors and environmental conditions will continue to impact future values of this indicator, thus influencing both national policy and the everyday lives of citizens worldwide.

                    
# Install missing packages
import sys
import subprocess

def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])

# Required packages
for package in ['wbdata', 'country_converter']:
try:
__import__(package)
except ImportError:
install(package)

# Import libraries
import wbdata
import country_converter as coco
from datetime import datetime

# Define World Bank indicator code
dataset_code = 'MS.MIL.TOTL.TF.ZS'

# Download data from World Bank API
data = wbdata.get_dataframe({dataset_code: 'value'},
date=(datetime(1960, 1, 1), datetime.today()),
parse_dates=True,
keep_levels=True).reset_index()

# Extract year
data['year'] = data['date'].dt.year

# Convert country names to ISO codes using country_converter
cc = coco.CountryConverter()
data['iso2c'] = cc.convert(names=data['country'], to='ISO2', not_found=None)
data['iso3c'] = cc.convert(names=data['country'], to='ISO3', not_found=None)

# Filter out rows where ISO codes could not be matched — likely not real countries
data = data[data['iso2c'].notna() & data['iso3c'].notna()]

# Sort for calculation
data = data.sort_values(['iso3c', 'year'])

# Calculate YoY absolute and percent change
data['value_change'] = data.groupby('iso3c')['value'].diff()
data['value_change_percent'] = data.groupby('iso3c')['value'].pct_change() * 100

# Calculate ranks (higher GDP per capita = better rank)
data['rank'] = data.groupby('year')['value'].rank(ascending=False, method='dense')

# Calculate rank change from previous year
data['rank_change'] = data.groupby('iso3c')['rank'].diff()

# Select desired columns
final_df = data[['country', 'iso2c', 'iso3c', 'year', 'value',
'value_change', 'value_change_percent', 'rank', 'rank_change']].copy()

# Optional: Add labels as metadata (could be useful for export or UI)
column_labels = {
'country': 'Country name',
'iso2c': 'ISO 2-letter country code',
'iso3c': 'ISO 3-letter country code',
'year': 'Year',
'value': 'GDP per capita (current US$)',
'value_change': 'Year-over-Year change in value',
'value_change_percent': 'Year-over-Year percent change in value',
'rank': 'Country rank by GDP per capita (higher = richer)',
'rank_change': 'Change in rank from previous year'
}

# Display first few rows
print(final_df.head(10))

# Optional: Save to CSV
#final_df.to_csv("gdp_per_capita_cleaned.csv", index=False)
                    
                
                    
# Check and install required packages
required_packages <- c("WDI", "countrycode", "dplyr")

for (pkg in required_packages) {
  if (!requireNamespace(pkg, quietly = TRUE)) {
    install.packages(pkg)
  }
}

# Load the necessary libraries
library(WDI)
library(dplyr)
library(countrycode)

# Define the dataset code (World Bank indicator code)
dataset_code <- 'MS.MIL.TOTL.TF.ZS'

# Download data using WDI package
dat <- WDI(indicator = dataset_code)

# Filter only countries using 'is_country' from countrycode
# This uses iso2c to identify whether the entry is a recognized country
dat <- dat %>%
  filter(countrycode(iso2c, origin = 'iso2c', destination = 'country.name', warn = FALSE) %in%
           countrycode::codelist$country.name.en)

# Ensure dataset is ordered by country and year
dat <- dat %>%
  arrange(iso3c, year)

# Rename the dataset_code column to "value" for easier manipulation
dat <- dat %>%
  rename(value = !!dataset_code)

# Calculate year-over-year (YoY) change and percentage change
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(
    value_change = value - lag(value),                              # Absolute change from previous year
    value_change_percent = 100 * (value - lag(value)) / lag(value) # Percent change from previous year
  ) %>%
  ungroup()

# Calculate rank by year (higher value => higher rank)
dat <- dat %>%
  group_by(year) %>%
  mutate(rank = dense_rank(desc(value))) %>% # Rank countries by descending value
  ungroup()

# Calculate rank change (positive = moved up, negative = moved down)
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(rank_change = rank - lag(rank)) %>% # Change in rank compared to previous year
  ungroup()

# Select and reorder final columns
final_data <- dat %>%
  select(
    country,
    iso2c,
    iso3c,
    year,
    value,
    value_change,
    value_change_percent,
    rank,
    rank_change
  )

# Add labels (variable descriptions)
attr(final_data$country, "label") <- "Country name"
attr(final_data$iso2c, "label") <- "ISO 2-letter country code"
attr(final_data$iso3c, "label") <- "ISO 3-letter country code"
attr(final_data$year, "label") <- "Year"
attr(final_data$value, "label") <- "GDP per capita (current US$)"
attr(final_data$value_change, "label") <- "Year-over-Year change in value"
attr(final_data$value_change_percent, "label") <- "Year-over-Year percent change in value"
attr(final_data$rank, "label") <- "Country rank by GDP per capita (higher = richer)"
attr(final_data$rank_change, "label") <- "Change in rank from previous year"

# Print the first few rows of the final dataset
print(head(final_data, 10))