function build_mat_files() % This function creates mat files from Penn World Tables 6.3. (Alan Heston, Robert Summers and Bettina Aten, Penn World Table Version 6.3, % Center for International Comparisons of Production, Income and Prices at the University of Pennsylvania, August 2009). % % stephane DOT adjemian AT ens DOT fr % Sun Nov 15 18:19:12 2009 first_year = 1950; last_year = 2007; number_of_countries = 198; nobs = last_year-first_year+1; map = zeros(number_of_countries,2); map(:,1) = transpose(0:(number_of_countries-1))*nobs+1; map(:,2) = transpose(1:number_of_countries)*nobs; % List of country names fid = fopen('pwt_names.csv','r'); tmp = textscan(fid,'%s','Delimiter','\n'); fclose(fid); [junk,n,m] = unique(tmp{1}); names = tmp{1}(sort(n),:); names = cell2mat(names); save('pwt_names.mat','names','map'); % List of country codes fid = fopen('pwt_codes.csv','r'); tmp = textscan(fid,'%s','Delimiter','\n'); fclose(fid); [junk,n,m] = unique(tmp{1}); codes = tmp{1}(sort(n),:); codes = cell2mat(codes); save('pwt_codes.mat','codes','map'); % List of variables fid = fopen('pwt_variables.csv','r'); tmp = textscan(fid,'%s','Delimiter','\n'); fclose(fid); variables = cell2mat(tmp{1}); save('pwt_variables.mat','variables'); % data pwt = load('pwt63.csv','-ascii'); save('pwt63.mat','pwt');