$Title Weighted Tariff Rates 1 *============================================================================= $ontext (1) This is the accompanying GAMS code for the note: Corong, Erwin (2007). "Computing for Import-Weighted Average Tariff Rates". Available at: www.pep-net.org Poverty and Economic Policy (PEP) Research Network. (2) This code maps tariff data from Excel into GAMS using the GDX facility (3) The main objective of this exercise is to demonstrate how weighted average tariff rates can be computed in GAMS Coded by: Erwin L. Corong Please send comments to erwincorong@gmail.com This code is freely distributed without any warranty. Users can share or modify it. However, it should not be used to misrepresent any person or institution stated herein. The usual disclaimer applies. April 2007 $offtext *============================================================================= *========================= Read data from excel ============================== $call gdxxrw tariff_data.xls par=tariff rng=data!c5:f15 *============================================================================= *======================= Defining a name for the data ======================== parameter tariff(*,*) Sam data *============================================================================= *========================= CALLING AND LOADING GDX FILE ====================== $gdxin tariff_data.gdx $load tariff display tariff *============================================================================= *============================= SET DECLARATION =============================== set n numeric labels / 1*10 / set i sectors / AGRI Agriculture FISH Fishing FORE Forestry MNQG Mining and Quarrying FOOD Food Manufacturing NFOO Non-Food Manufacturing CONS Construction TRAN Transportation FINA Finance PSER Private Services / set tr Tariff and import data / tar05 2005 tariff rates tar07 2007 tariff rates imports Base (2005) imports / set mapi(n,i) mapping numeric labels to sectors / 1. AGRI 2. FISH 3. FORE 4. MNQG 5. FOOD 6. NFOO 7. CONS 8. TRAN 9. FINA 10.PSER / set mapot(n,tr) mapping numeric lables to other data / 1. imports Base (2005) imports 2. tar05 2005 tariff rates 3. tar07 2007 tariff rates / ALIAS (m,n), (i,j); *============================================================================= *============================= Data Handling ================================ *============================= Data Handling ================================ PARAMETER IMPDAT IMPORT DATA TAR05 2005 TARIFF DATA TAR07 2007 TARIFF DATA ; IMPDAT(i,"Imports")= sum((n,m)$(mapi(n,i) and mapot(m,"Imports")),tariff(n,m)); TAR05(i,"tar05")= sum((n,m)$(mapi(n,i) and mapot(m,"tar05")),tariff(n,m)); TAR07(i,"tar07")= sum((n,m)$(mapi(n,i) and mapot(m,"tar07")),tariff(n,m)); DISPLAY IMPDAT, TAR05, TAR07 ; *============================================================================= *======================= SET DECLARATION FOR DATA AGGREGATION ================ *Aggregation sets (Maps) Set G sectoral classifications / AGR Agriculture MFG Manufacturing SER Services / Set Map(*,*) mapping individual industry to sectoral classifications / AGRI.AGR FISH.AGR FORE.AGR MNQG.MFG FOOD.MFG NFOO.MFG CONS.SER TRAN.SER FINA.SER PSER.SER / *============================================================================= *============================================================================= *===== Computing for Weighted Tariff Rates by sectoral Classifications ======= parameter tar_imp_05(i) 2005 tariff rates of i multiplied by imports of i tar_imp_07(i) 2007 tariff rates of i multiplied by imports of i sum_tar_05(g) sum of tar_imp_05 by sectoral classification (g) agg_imp_05(g) Aggregated imports for 2005 weight_tar05(g) Weighted Tariff Rates in 2005 sum_tar_07(g) sum of tar_imp_07 by sectoral classification (g) weight_tar07(g) Weighted Tariff Rates in 2007 ; tar_imp_05(i) = tar05(i,"tar05")*IMPDAT(i,"Imports"); tar_imp_07(i) = tar07(i,"tar07")*IMPDAT(i,"Imports"); sum_tar_05(g) = sum((i)$(map(i,g)), tar_imp_05(i)); agg_imp_05(g) = sum(i$map(i,g),impdat(i,"imports")); weight_tar05(g) = sum_tar_05(g) / agg_imp_05(g); sum_tar_07(g) = sum((i)$(map(i,g)), tar_imp_07(i)); weight_tar07(g) = sum_tar_07(g) / agg_imp_05(g); display tar_imp_05,tar_imp_07,sum_tar_05, agg_imp_05, weight_tar05, weight_tar07; *============================================================================= *============================================================================= *=== Computing for Weighted Change in Tariff Rates between 2005 and 2007 ===== Parameter Wch_tariff(g) Weighted Change in Tariff rates between 2005 and 2007 ; Wch_tariff(g) = (weight_tar07(g)/weight_tar05(g)-1) * 100 ; display Wch_tariff ; *============================================================================= *================= Unloading to Excel through GDX ============================ execute_unload 'tariff_data.gdx', weight_tar05, weight_tar07, Wch_tariff execute 'gdxxrw.exe tariff_data.gdx o=weighted_tariff.xls par=weight_tar05 rng=a1 par=weight_tar07 rng=a4 par=Wch_tariff rng=a7' *============================================================================= *=========================End of the GAMS Code ===============================