function [Y,year,y,pai,irate,dy,dpai,dirate] = trim_data(year0,year1)
%trim_data.m shortens the data range
%Replication materials for: ``What Do Long Data Tell Us About the Inflation Hike Post COVID-19 Pandemic?''
%© Stephanie Schmitt-Grohé and Martín Uribe, 2023. 

if nargin<1 | isempty(year0)
year0 = 1900;
end

if nargin<2 | isempty(year1)
year1 = 2022;
end

%read data
load ..\data_2022\data_1900_2022.mat  year Y y pai irate dy dpai dirate 
%produced by running data_2022\data_1900_2022.m

aux0 = find(year==year0);
aux1 = find(year==year1);

Y = Y(aux0:aux1,:);
year = year(aux0:aux1);
y = y(aux0:aux1);
pai = pai(aux0:aux1);
irate = irate(aux0:aux1);
dy = dy(aux0:aux1);
dpai = dpai(aux0:aux1);
dirate = dirate(aux0:aux1);
