%% =====================================================================
%  Author      :  Mahmut S. İpek (Bilkent University)
%  E-mail      :  mahmuts@bilkent.edu.tr
%  Webpage     :  https://www.bilkent.edu.tr/~mahmuts
%  Date        :  05-Mar-2026 21:57, Ankara
%  Description :  Retrieve data from Eurostat
% ------------------------------------------------------------------------

% Housecleaning
clc; clear; warning("off");

% GDP — quarterly national accounts
GDP_data = fetchEurostat_v2('namq_10_gdp', ...
    'params', {'unit','CLV_I20', 's_adj','SCA', 'na_item','B1GQ', 'geo','EA21'}, ...
    'varName', 'EA_GDP', ...
    'start',   datetime(1995,1,1));

% Employment — national accounts employment
EMP_data = fetchEurostat_v2('namq_10_a10_e', ...
    'params', {'unit','I15_PER', 'nace_r2','TOTAL', 's_adj','SCA', 'na_item','EMP_DC', 'geo','EA21'}, ...
    'varName', 'EA_Emp', ...
    'start',   datetime(2000,1,1));

% Employment — hours worked
HW_data = fetchEurostat_v2('namq_10_a10_e', ...
    'params', {'unit','I15_HW', 'nace_r2','TOTAL', 's_adj','SCA', 'na_item','EMP_DC', 'geo','EA21'}, ...
    'varName', 'EA_Emp', ...
    'start',   datetime(2000,1,1));

% Production — value added by NACE (multiple nace_r2 values)
GVA_sectors = fetchEurostat_v2('namq_10_a10', ...
    'params', {'unit','CLV_I20', 's_adj','SCA', ...
    'nace_r2','TOTAL', 'nace_r2','A', 'nace_r2','B-E', ...
    'nace_r2','F', 'nace_r2','G-I', 'nace_r2','J', ...
    'nace_r2','K', 'nace_r2','L', 'nace_r2','M_N', ...
    'nace_r2','O-Q', 'nace_r2','R-U', ...
    'na_item','B1G', 'geo','EA21'}, ...
    'varName', 'EA_VA', ...
    'start',   datetime(2000,1,1));

% Production — contribution to growth - value added by NACE (multiple nace_r2 values)
GVA_sectors_cont_sm = fetchEurostat_v2('namq_10_a10', ...
    'params', {'unit','CON_PPCH_SM', 's_adj','SCA', ...
    'nace_r2','TOTAL', 'nace_r2','A', 'nace_r2','B-E', ...
    'nace_r2','F', 'nace_r2','G-I', 'nace_r2','J', ...
    'nace_r2','K', 'nace_r2','L', 'nace_r2','M_N', ...
    'nace_r2','O-Q', 'nace_r2','R-U', ...
    'na_item','B1G', 'geo','EA21'}, ...
    'varName', 'EA_VA', ...
    'start',   datetime(2000,1,1));

% Production — contribution to growth - value added by NACE (multiple nace_r2 values)
GVA_sectors_cont_pre = fetchEurostat_v2('namq_10_a10', ...
    'params', {'unit','CON_PPCH_PRE', 's_adj','SCA', ...
    'nace_r2','TOTAL', 'nace_r2','A', 'nace_r2','B-E', ...
    'nace_r2','F', 'nace_r2','G-I', 'nace_r2','J', ...
    'nace_r2','K', 'nace_r2','L', 'nace_r2','M_N', ...
    'nace_r2','O-Q', 'nace_r2','R-U', ...
    'na_item','B1G', 'geo','EA21'}, ...
    'varName', 'EA_VA', ...
    'start',   datetime(2000,1,1));

% Industrial production index — monthly
IPI_data = fetchEurostat_v2('sts_inpr_m', ...
    'params', {'nace_r2','B-D', 's_adj','SCA', 'unit','I21', 'geo','EA21'}, ...
    'varName', 'EA_IPI', ...
    'start',   datetime(2000,1,1));

% Construction output index — monthly
CONS_data = fetchEurostat_v2('sts_copr_m', ...
    'params', {'nace_r2','F', 's_adj','SCA', 'unit','I21', 'geo','EA21'}, ...
    'varName', 'EA_CONS', ...
    'start',   datetime(2000,1,1));

% GDP expenditure components — quarterly
GDP_comp = fetchEurostat_v2('namq_10_gdp', ...
    'params', {'unit','CLV_I20', 's_adj','SCA', ...
    'na_item','B1GQ', ...
    'na_item','P3_S13', ...
    'na_item','P31_S14_S15', ...
    'na_item','P51G', ...
    'na_item','P52_P53', ...
    'na_item','P6', ...
    'na_item','P7', ...
    'geo','EA21'}, ...
    'varName', 'EA_GDP', ...
    'start',   datetime(1995,1,1));

% GDP expenditure components — quarterly
GDP_comp_cont_pre = fetchEurostat_v2('namq_10_gdp', ...
    'params', {'unit','CON_PPCH_PRE', 's_adj','SCA', ...
    'na_item','B1GQ', ...
    'na_item','P3_S13', ...
    'na_item','P31_S14_S15', ...
    'na_item','P51G', ...
    'na_item','P52_P53', ...
    'na_item','P6', ...
    'na_item','P7', ...
    'geo','EA21'}, ...
    'varName', 'EA_GDP', ...
    'start',   datetime(1995,1,1));

% GDP expenditure components — quarterly
GDP_comp_cont_sm = fetchEurostat_v2('namq_10_gdp', ...
    'params', {'unit','CON_PPCH_SM', 's_adj','SCA', ...
    'na_item','B1GQ', ...
    'na_item','P3_S13', ...
    'na_item','P31_S14_S15', ...
    'na_item','P51G', ...
    'na_item','P52_P53', ...
    'na_item','P6', ...
    'na_item','P7', ...
    'geo','EA21'}, ...
    'varName', 'EA_GDP', ...
    'start',   datetime(1995,1,1));

% Unemployment rate — monthly
UNEMP_data = fetchEurostat_v2('une_rt_m', ...
    'params', {'s_adj','SA', 'age','TOTAL', 'unit','PC_ACT', 'sex','T', 'geo','EA21'}, ...
    'varName', 'EA_UNEMP', ...
    'start',   datetime(2000,1,1));

% Employment by NACE sector — quarterly
EMP_data_sectors = fetchEurostat_v2('namq_10_a10_e', ...
    'params', {'unit','I15_PER', ...
    'nace_r2','TOTAL', ...
    'nace_r2','A', ...
    'nace_r2','B-E', ...
    'nace_r2','C', ...
    'nace_r2','F', ...
    'nace_r2','G-I', ...
    'nace_r2','J', ...
    'nace_r2','K', ...
    'nace_r2','L', ...
    'nace_r2','M_N', ...
    'nace_r2','O-Q', ...
    'nace_r2','R-U', ...
    's_adj','SCA', 'na_item','EMP_DC', 'geo','EA21'}, ...
    'varName', 'EA_EMP', ...
    'start',   datetime(1995,1,1));

% Employment by NACE sector — quarterly
HW_data_sectors = fetchEurostat_v2('namq_10_a10_e', ...
    'params', {'unit','I15_HW', ...
    'nace_r2','TOTAL', ...
    'nace_r2','A', ...
    'nace_r2','B-E', ...
    'nace_r2','C', ...
    'nace_r2','F', ...
    'nace_r2','G-I', ...
    'nace_r2','J', ...
    'nace_r2','K', ...
    'nace_r2','L', ...
    'nace_r2','M_N', ...
    'nace_r2','O-Q', ...
    'nace_r2','R-U', ...
    's_adj','SCA', 'na_item','EMP_DC', 'geo','EA21'}, ...
    'varName', 'EA_HW', ...
    'start',   datetime(1995,1,1));
