Sunday, April 2, 2023

Dabbling with Trade Data from Customs: Changing Cumulative values to Monthly trade values using STATA

This blog is aimed at helping readers find monthly trade patterns of Nepal for a given month in a given year by analyzing customs cumulative data on Nepal's import and export. The data can be found on the customs data portal and should be downloaded for each month separately. Once downloaded, you should focus on the "Imports by Commodity Partner" sheet and analyze the following variables: HSCode, Description, Quantity, Unit, Country, Values, and Revenue.

Firstly, you will have to delete the first two columns of each file. You can do it without deleting manually as well by running a few other codes, but I decided to delete it manually as I incurred a few errors that took a lot of my time to solve, while trying to do it without running the code. The two columns at the top pointed by the arrow are the ones that you will have to get rid of: 

Secondly, given that you will have to pull multiple files all at once and append it later. It is essential to keep in mind that when pulling multiple files at once, it is crucial to store all files in the same folder to avoid any errors in running the command. Therefore, one should ensure that all files are stored in a specific folder.

Furthermore, it is recommended to name each file using a numerical format, such as naming the first month's file as "1" and the second month's file as "2", and so on. This naming convention helps in easily identifying the files and automating the process of appending the data later. The image below illustrates how the files can be saved in a folder using this naming convention. You can use other methods but naming the files in numeric order makes it easy and quick to atomate the process. 

Now, given that you set the directory and do some data cleaning manually as mentioned above, you should proceed on to run a loop that pulls all 12 files uploaded on the same folder taken from customs portal. Run the following command after that: 

forvalues i=1/12{
clear
import excel `i', sheet("4_Imports_By_Commodity_Partner") firstrow
gen Month=.
replace Month=`i' if `i'==`i'
save `i'.dta, replace 
}

The command mentioned in the previous section imports all 12 months' files at once and converts them to. dta format, saving them in the same folder. By specifying the sheet "Imports by Commodity Partner," the code filters out other unnecessary sheets and extracts only the relevant data required for monthly analysis. If readers want to analyse other parameters, they can refer to other sheets and modify the code accordingly.

Also, to identify the month in which an import transaction took place, the code generates a variable called "Month" and replaces the observations on this variable with the name of the file itself. For instance, if the file name is "1", then the Month variable in that particular file will have the value of the Month as "1." By generating this variable, you can easily identify the month in which each transaction took place. 

Now, we have to run a loop again that appends all 12 files. Append command lists all the in order, i.e, if you append file 1 and file 2, all the observations from file 2 will be kept below file 1. Use the following command for that:

forvalues i =1/5 {
append using `i'.dta 
}

Your data should look somewhat like this. Check the Month columns, you can see data from all Months. 

You might incur a minor error while running these commands which is that the last file, i.e 12, might run twice. In such scenario, you can drop the duplicate values by running the following command:

duplicates drop if Month==5

Now, usually, I change the variables names that look familiar for simplicity. This is all up to you. If you want to change it, then you can change, if not, don’t change. But if you change the variable names, make sure you use the same variable name to run the command later. 

drop if HSCode==""
rename Imports_Revenue Revenue
rename Imports_Value Value
ren PartnerCountries Country

Now, I will have to sort the variables. I am keeping the variables HSCode and Country in descending order and Month in ascending order for which I will have to run the command as mentioned below: 

gsort -HSCode -Country Month

I am doing this mostly because I want to deduct each month’s data with earlier month data which gives us the import value of each month in absolute number which is exactly what we are looking for. Run the command as mentioned below for that: 

        gen total=Value-Value[_n-1]
gen QTY=Quantity-Quantity[_n-1]
gen Revenue1=Revenue-Revenue[_n-1]

        replace total=Value if Month<=Month[_n-1]
replace QTY=Quantity if Month<=Month[_n-1]
replace Revenue1=Revenue if Month<=Month[_n-1]

//rearranging variable names for simplicity 
drop Quantity Value Revenue
rename total Value 
rename Revenue1 Revenue

Your data should look somewhat like this: 

Now, rename the months in numeric values with alphabet, i.e., the first month in a fiscal year is Shrawan which is, hence, you need to replace 1 with Shrawan. Use the command below, 

//generating a new variable and replacing the variable with respective months 
gen Month1=""
replace Month1="Shrawan" if Month==1
replace Month1="Bhadra" if Month==2
replace Month1="Ashoj" if Month==3
replace Month1="Kartik" if Month==4
replace Month1="Mangsir" if Month==5

Use the same code for other months as well by changing the Value of the Month accordingly. 

//rearranging variable names for simplicity 
drop x x2 x3 x4 Month
rename Month1 Month

Your data should look somewhat like this: 

While working with customs data, it is important to note that errors may occur. In some cases, the data may contain inconsistencies or discrepancies that can affect the accuracy of the analysis. For instance, in the case of the year 2077-78, it was found that the customs data itself had some errors. Specifically, the same goods were imported with different unit values, such as a bottle being imported in both KG and PCS units, leading to confusion in the analysis.

Furthermore, it is possible to encounter other errors while working with customs data, such as discrepancies in cumulative values between different months. For example, it may be observed that the cumulative value of the 4th month appears to be higher than that of the 5th month, which is mathematically impossible if the values are all positive. This makes the data inconsistent and requires careful consideration.

Therefore, when working with customs data, it is important to exercise caution and carefully analyze the data to identify any errors or discrepancies that may affect the accuracy of the analysis. By doing so, you can derive meaningful insights and draw accurate conclusions about Nepal's monthly trade patterns.

While as a data analyst or economist, we can do nothing about the error with respect to cumulative value, other than contacting the customs department and inquiring about it. While errors in customs data can pose challenges for data analysts and economists, there are still ways to work towards improving the accuracy of our analysis and gaining meaningful insights from the data. Hence, what we can do is, try to see which HSCode product were imported in different Unit and try to modify the values slightly wherever necessary. Run the command as mentioned below: 

duplicates list HSCode Country Month
egen x=group (Unit)
tab x
bys HSCode Country: egen x2=min(x)
bys HSCode Country: egen x3=max(x)
ins x*
gen x4=x2-x3
su x4
tab x4
tab HSCode if x4!=0
gsort -HSCode -Country Month
brow if x4!=  0

When you run the group (Unit) command, you should get something like this on your console window on STATA: 

The above-mentioned command will show you all such products sold in two different Unit. As shown in the picture below, the same product is sold in MTR and SQM. 


To address discrepancies in customs data where the same product is imported with different unit values, one approach is to check the values for each HSCode and replace the unit value with the unit value that has been imported with the highest value. For instance, if a product with HS Code 23556892 is imported in both Kg and PCS units, we can check how much of that product has been imported in each unit. If the imported value in Kg is higher than that in PCS, we can replace the PCS unit with Kg and drop any duplicate values.

For example, we have such issues with HSCode= 39269099 which is sold oin KG and PCS both. For that run a similar command as mentioned below as per the HSCode: 

tab Unit if HSCode=="39269099"   
total Value if HSCode=="39269099" & Unit=="Kg"
total Value if HSCode=="39269099" & Unit=="PCS"
replace Unit="KG" if x==9 & x2==4 & x3==9 & x4==-5 & HSCode=="39269099"

Here, the HSCode had its maximum imports in KG, hence we change all the unit with PCS to KG and add the value for the same products and drop duplicates. 

To drop duplicates and add values with respect to the HS Code and Country, use the following command: 

bys HSCode Country Month: egen total_1=sum(total)
bys HSCode Country Month: egen QTY_1=sum (QTY)
bys HSCode Country Month: egen Revenue_1=sum (Revenue1)
duplicates drop HSCode Country Month, force

However, it's worth noting that this approach may not be applicable to all cases and should be used with caution.

You can now save and export the data in excel or whichever format you want your data on. 

Cheers!!!



Sunday, December 18, 2022

Navigating the 8-digit HS Code into universal 6-digit HS Code Classification: Its process using STATA

The uniform Harmonized system (HS) code used across the world is defined by the 6-digit HS Code. However, many countries use the 8-digit HS Code as well. South Asian countries like Nepal, India, Pakistan and Bangladesh among others also use the 8-digit HS Code parameter. Hence, while playing around with the data concerning the international trade categorized in 6-digit code might create confusion and data discrepancy, if the logics behind 6 and 8-digit codes are mismatched. This article is a result of an effort to refrain from making that mistake. 

The overarching idea is that the first two digit of the 8-digit HS Code denotes “chapter”, first four digit denotes “sub-chapter” and the final 8 digit is the code for the product. For example, 02023000 is the HS Code for “Meat of bovine animals, frozen, boneless”. The first two digit (02) of this product is identified under the chapter as “Meat and edible meat offal” and the first four digit (0202) is identified under the sub-chapter as “Meat of bovine animals, frozen”. 

Now, in order to classify the products with the universal 6 digit HS Code, first, we need to distinguish the 8 digit code into 6 digit code. Then, we need to merge it with the uniform nomenclatures used across the world while trading. 

Here is the process;

As usual, like in the previous blog articles, I have used the data from Nepal’s Trade and Export Promotion Centre (TEPC) data portal, for the year 2020-21 (2077-78) as a reference for this article. 

Firstly, we need to download the data from the TEPC portal. My last article shows halfway work to what we are going to explore in this blog. Hence, I request you to follow my last article. Especially, check the final STATA command as it is pertinent to make sure that you don’t do double counting. After you run the code mentioned in the earlier article, you should get the data as such;


Secondly:  with the world wide used HS Code (6-digit)

The uniform nomenclatures classification can be found on World Integrated Trade Solution (WITS) data portal. You will have to login to the WITS portal and click on the tab “support materials” and click the “Product Nomenclature and Concordances”.  Now, for the latest HS Code classification, on the Nomenclature option, you will have to choose HS2017 and sub-heading (all 6 digit HS Code) on the level option. There are a total of 5388 product classification for 6 digit HS Code. You can download the excel version. The data will look somewhat like this: 

Now, we need to merge these two files used above to generate the final version of the trade value in 6 digit HS Code. Here, we need to understand a couple of things. Since, we are trying to see our trade value in universal Harmonise System, we need to delete the variable “Commodity” and “ValuesRs” from the TEPC data. Use the STATA command mentioned below; 

drop Commodity

drop ValuesRs

Here, we are dropping the variable "ValueRs" also because the total value in amount for each HS Code is created in other variable named “total_75”. The data should look somewhat like this after you delete Commodity; 


Now, we need to merge these two data. But before merging these data, we need to make sure that the names of both datasets have one common variable. Hence, the Nomenclature dataset should have it’s variable name with product identification as “HSCode” which is to say that we have to change the name from “HS2017 Product Code” to “HSCode”. Now use the following command: 

merge m:1 HSCode using “the file name.dta”

The data should look somewhat like this;

This gives us our HS Code classification and commodity description used commonly across the world. 

As simple as that!!!


Tuesday, September 27, 2022

Is Nepal heading towards a Sri Lanka like crisis? - A comparative Analysis

Sri Lanka’s public debt to GDP ratio has skyrocketed over the past few years with the IMF projecting its public debt to GDP to reach 119.9 percent in 2022. Nepal, on the other hand, is operating at a public debt to GDP ratio of 37.3 percent. Sri Lanka’s public debt to GDP ratio is very concerning. Studies highlight that a public debt to GDP ratio above 64 percent among emerging markets amounts for a loss of real GDP growth by 0.02 percent points with each additional percentage points increase in public debt. While the number might seem small, however, with cumulative effect with each percentage points increase can be devastating. Sri Lanka is operating at an almost double the public debt to GDP threshold. Countries with excessively high levels of public debt are more likely to lose their output during crisis and are more prone to spillover effects. That’s exactly what happened in  Sri Lanka’s case as well. During the pre-COVID era in 2019, Sri Lanka’s public debt was already very high at 93.6 percent. As the COVID pandemic surfaced the economy in 2020, its ability to cope with the crisis worsened. It became even worse when the spillover effects of Russia-Ukraine war hit the economy with massive inflation, food shortages and weak exchange rates. Not to forget, the 2019 tax cut and its impact on revenue, with estimated revenue loss crossing 2 percent of GDP. With rising expenditures and low revenue, fiscal deficits widened by 12.8 percent of GDP in 2020 and 11.4 percent in 2021. Owing to increasing fiscal deficits inter alia, public debt was pushed up massively. By 2020 Q3, public debt was 114 percent. Compared to Sri Lanka, Nepal is doing fairly well in this regard. 

Infact, Sri Lanka’s debt distress started taking an upward shift ever since a decade back. Given that Sri Lanka was upgraded to a middle-income country in the early 2000s, Sri Lanka’s access to concessional loan with low interest and high repayment periods from multilateral and bilateral organizations declined which pushed Sri Lanka to pursue commercial loans. Back in 2007, Sri Lanka issued its first International Sovereign Bond (ISB) of $500 million. In 2009, Sri Lanka’s commercial loans consisted of only 2.5 percent of external debt. By 2019, commercial borrowings consisted of 56 percent of total external debt and most of it were ISBs. Unlike the concessional loans, ISBs have higher interest rates and shorter repayment periods. 

Nepal hasn’t taken a commercial foreign loan yet although the International Development Cooperation Policy 2019 allows it. While Nepal’s debt to GDP ratio is gradually increasing, Nepal is still at a safe debt to GDP position. However, jumping to take heavy commercial loans or getting comfortable with taking any loans with high interest can easily shift the tide towards debt distress. Hence, such acts should not be initiated unless absolutely necessary. Unlike Sri Lanka, Nepal’s bilateral and multilateral deals largely pushes for grants and if it must be a loan, then it should be concessional loans or loans as similar as multilateral donor agencies which are less than 2 percent with high re-payment period. Having said that, it’s pertinent to understand that Nepal is also not in a comfortable position to take the whole debt distress scenario lightly especially given that the outstanding debt has shown a consistent increasing pattern over the past few years. 

It is evident that Sri Lanka’s public debt is unsustainable

Foreign exchange reserves of both countries are critically low. As mentioned earlier as well, Sri Lanka’s reserve is at a stage where they are already unable to pay for their imports largely reflecting pre-existing debt vulnerabilities, policy failures and the effects of exogenous shocks like pandemic and the ongoing war. Nepal Rastra Bank (NRB) aims to maintain foreign exchange reserves at a level that can sustain imports for at least 7 months. However, that target is compromised lately, for the first time in the last six years, which proposes a loud alarm to the economy. Between mid-July 2021 to mid-May 2022, Nepal’s gross exchange reserves tumbled down by 21.1 percent. Likewise, Sri Lanka’s foreign reserves tumbled down by 44.58 percent from 2020 to 2021 and has only seen a consistent downfall each month. Between May 2021 to May 2022, reserves went down by 53.21 percent. IMF estimates that Sri Lanka’s gross reserves over 2022-26 will remain extremely low at around 1 month of imports. Sri Lanka’s catastrophic state of currency reserves can be a wake-up call for Nepal given that Nepal still has time to boost its reserves. 

Likewise, Inflation has gone rampant all over the world, but tends to be much better when compared to Sri Lanka. Sri Lanka’s inflation rate has shown a consistent increase every month over the past year. Nepal and Sri Lanka were standing at a fairly good inflation position during August 2021. However, post 8 months by April 2022, Nepal and Sri Lanka had a difference in Inflation of 22.52 percent approximately. By July 2022, Sri Lanka was operating at an Inflation rate of 60.8 percent and given the consistent economic debacle, it is not expected to improve anytime soon. 

Food and Non-Alcoholic Beverages in Sri Lanka saw its Consumers Price Index (CPI) reach 90.9 percent on June 2022. Transport sector crossed the century mark with a whopping 143.6 percent. Largely, due to fuel shortages and inability of purchasing fuel with its worsening foreign exchange reserves, Sri Lanka was forced to call for a fuel lockdown. Nepal, on the other hand, is operating at a fairly comfortable position when compared to Sri Lanka in this regard. Although, the situation in Nepal also needs a dire attention when it comes to inflation of daily necessities. Mid May/June comparison shows a 7.43 percent CPI on food and Beverage. Like in Sri Lanka, Nepal is also embracing the impacts of war with the rising fuel prices creating the largest inflationary pressure on transportation sector with about 25.79 percent.

Policy Recommendation 

Matters went multifold worse due to back-to-back exogenous shocks. Nepal’s high imports over the last couple of months is largely accommodated by inflated fuel prices subsequently hampering the country’s reserves. Nepalese government has taken steps to ban a few products considered as luxurious goods on a temporary basis in order to avoid an outsource of dollars from the country. However, moves as such, hardly brings sustainable solution. Instead of focusing on restricting imports, focusing on encouraging exports would be a welcome move for the medium or long-term recovery. In fact, for the short term, Nepal can try increasing taxes on luxurious goods or goods that are imported in heavy amounts instead of initiating an import ban, like the austerity policy initiated by Bangladesh. 

Nepal’s export scenario is considerably vulnerable given that a significant chunk of our export is largely boosted by soybean oil and palm oil imported from third countries which are exported to India with a minor value addition. Between 2075-76 to 2077-78, approximately 29% of Nepal’s total export was covered by Soybean oil and Palm oil accounting for NRS 97.34 billion worth out of the total export of NRS 335.94 billion. The fear factor here is that the strength of Nepal’s export of palm oil and soybean oil is largely in the hands of India. If India applies quota or issues import ban of these products like they did earlier in a temporary manner, Nepal’s export scenario will get worse, and it will hit harder than before with the current reserves in a very fickle state. Hence, there is a strong need for Nepal to avoid heavy dependence on few products that aren’t even produced in the country. A concrete pathway to pursue a sustainable and long-term export ease should be of utmost priority. 

Likewise, Nepalese government needs to refrain from making a mockery out of themselves by coming into attention with consistent political fiasco and multiple controversies. The case of Finance Ministry and Nepal Rastra Bank (NRB) is a fresh example. Finance Ministry is the fiscal body and NRB is the monetary body of the nation. Fighting with each other like a cat and dog is not something that any economy would expect from the two most important body of the nation. Friendly and effective collaboration is a must between these two departments, especially, in a time like today, whereby the macroeconomic crisis is consistently looming around the corner. 

Friday, July 8, 2022

Category based Export of Nepal (2020-21)- Data management using STATA

 
I have used the data from Trade and Export Promotion Centre (TEPC) data portal, for the year 2020-21 (2077-78) as a reference for this article. Although, same code and logic could be used for any country's trade based data given that we are cleaning the data in terms of category (i.e Clothing, Textiles etc). There are 22 categories in which all goods come under. Such is the case because the Harmonised System (HS) Code identification for Category based description  is identical for all countries. I will talk more about this later in the article. 

Firstly, we need to download the data from the TEPC portal. My last article shows halfway work to what we are going to explore in this blog. Hence, I request you to follow my last article till the end of 8 digit HS Code portion(i.e till drop if Country==""). After you run the code mentioned in the earlier article, you should get the data as such;
Now, as per the need of your research or wish, you can drop the variable “Unit” and “Quantity". Here, I will keep it for now. 

The most tricky part is the identification of particular good into a particular category. Example, How do you know which good comes under “Textiles” or “Clothing”? 

WTO has categorised goods into a particular category which is largely identified in terms of HS Code. For simplicity, I am attaching the WTO defined categorisation which is mentioned in this PDF here: https://unctad.org/system/files/official-document/wto2018_en.pdf Open this report and go to page 33. You will see the definition of groups in terms of agricultural products and non-agricultural products and the categories identified in terms of chapter (i.e chap 01), 4 digit (i.e 1601) or 6 digit (i.e 150410). 

Now, it's pertinent to understand what "4 or 6" digit HS Code and "chap" mean in this case. The first two digit basically tells you various chapters of the list under which many products are identified. If you look at the data right after downloading or before cleaning it, you would see the product description in terms of chapters as well. This two digit code further helps in identifying the product category at 4 digit HS Code. And the last two digit code is specific to the products that are exported as per 6 digit HS Code description. 

Nepal uses 8 digit HS Code which you could see in the data as well. Hence, to categorize the product or goods in their respective category, we will have to adjust the category by taking into account every description mentioned in the HS Code nomenclature list of the pdf. 

For that, firstly, you will have to create three variables HS2 denoting chapter, HS4 denoting 4 digit HS Code, HS6 denoting 6 digit HS Code. 

gen HS2=""
gen HS4=""
gen HS6=""

Also,  generate a new variable “Category” and leave it blank for now, so that we can replace the blank space with respective category later. 

gen Category

Now, you will have to divide the variable “HS Code” into three portion. The first two digit should be replaced as observation in the variable “HS2”, first 4 digit in the variable “HS4”, and first 6 digit in the variable “HS6”. 

replace HS2 = substr(HSCode,1,2)
replace HS4 = substr(HSCode,1,4)
replace HS6 = substr(HSCode,1,6)

The data should look like this;

While running the above mentioned code, I incurred some issues related to numeric adjustment of the observation among the variables that had the observation as string. As you can see in the figure above, the variable “HS2” has single digit observation (i.e 2 when it should be 02). In order to get rid of this trouble, you will have to the convert the string variable into numeric form for which you will have to use destring command. 

destring HS2, replace
destring HS4, replace 
destring HS6, replace 

Given that we are looking at "Category" only and not the export in terms of country, we can drop Country

drop Country

Now, the most tedious part begins whereby you will have to manually code every chapter, 4 or 6 digit description mentioned in the pdf. Get ready for some labour work here. Use the command as addressed below;

//Agricultural Products 
replace Category= "Animal Products" if HS2==01|HS2==02|(HS4>=1601 & HS4<=1602)
replace Category= "Dairy Products" if (HS4>=0401 & HS4<=0406) 
replace Category= "Fruits, Vegetables, Plants" if HS2==07|HS2==08|HS2==13|HS2==14|(HS4>=0601 & HS4<=0603)|HS4==1105|HS4==1106|(HS4>=2001 & HS4<=2008)|HS4==1211
replace Category= "Coffee, Tea" if HS2==18|HS4==0901|HS4==0902|HS4==0903|HS4==2101
replace Category="" if HS4==1802
replace Category= "Cereals and Preparations" if HS2==19|HS2==10|(HS4>=0407 & HS4<=0410)|(HS4>=1101 & HS4<=1104)|(HS4>=1107 & HS4<=1109)|(HS4>=2102 & HS4<=2106)|HS4==2209
replace Category= "Oilseeds, Fats & Oils" if HS2==15|(HS4>=1201 & HS4<=1208)|(HS4>=2304 & HS4<=2306)|HS4==3823
replace Category="" if HS6==150410|HS6==150420
replace Category= "Sugars and confectionery" if HS2==17
replace Category= "Beverages and tabacco" if HS2==24|HS4==2009|(HS4>=2201 & HS4<=2208)
replace Category= "Cotton" if (HS4>=5201 & HS4<=5203)
replace Category= "Other agricultural products" if (HS4>=0904 & HS4<=0910)|HS2==05|HS4==0604|(HS4>=1209 & HS4<=1210)|(HS4>=1212 & HS4<=1214)|HS4==1802|HS6==230110|HS4==2302|HS4==2303|(HS4>=2307 & HS4<=2309)|(HS6>=290543 & HS6<=290545)|HS4==3301|(HS4>=3501 & HS4<=3505)|HS6==380910|HS6==382460|(HS4>=4101 & HS4<=4103)|HS4==4301|(HS4>=5001 & HS4<=5003)|(HS4>=5101 & HS4<=5103)|HS4==5301|HS4==5302
replace Category="" if HS4==0508| HS6==051191

//Non-agricultural Products 
replace Category= "Fish and fish products" if HS2==03|HS4==0508|HS6==051191|HS6==150410|HS6==150420|HS6==230120|(HS4>=1603 & HS4<=1605)
replace Category= "Minerals and Metals" if (HS4>=2601 & HS4<=2617)|HS4==2620|(HS2>=72 & HS2<=76)|(HS2>=78 & HS2<=83)|HS2==25|(HS4>= 2618 & HS4<= 2619)|HS4==2621|(HS4>= 2701 & HS4<= 2704)|(HS4>= 2706 & HS4<= 2708)|(HS4>= 2711 & HS4<= 2715)|HS2==31|HS4==3403|(HS2>=68 & HS2<= 71)| (HS6>=911310 & HS6<=911320)
replace Category= "" if (HS4>= 7321 & HS4<= 7322)|(HS4>= 8304 & HS4<= 8305)|HS4==6807|(HS6>= 701911 & HS6<= 701919)|(HS6>= 701940 & HS6<= 701959)
replace Category= "Petroleum" if HS4==2709| HS4==2710
replace Category= "Chemicals" if HS4==2705|(HS2>=28 & HS2<=30)|(HS2>=32 & HS2<=34)|HS4==3506|HS4==3507|(HS4>=3601 & HS4<=3604)|(HS2>=37 & HS2<=39)
replace Category="" if (HS6>=290543 & HS6<=290545)|HS6==300590|HS4==3301|HS6==330620|HS4==3403|HS4==3406|HS6==380910|HS4==3823|HS6==382460|(HS6>=392112 & HS6<=392113)|HS6==392190
replace Category= "Wood, paper, etc" if HS2==44|HS2==45|HS2==47|HS2==48|HS2==49|HS6==961900|(HS4>=9401 & HS4<=9404)
replace Category="" if HS6==940490
replace Category= "Textiles" if HS6==300590|HS6==330620|(HS6>=392112 & HS2<=392113)|HS6==392190|HS6==420212|HS6==420222|HS6==420232|HS6==420292|(HS2>=50 & HS2<=60)|HS2==63|HS6==640520|HS6==640610|(HS4>= 6501 & HS4<= 6505)|HS4==6601|(HS6>=701911 & HS6<=701919)|(HS6>=701940 & HS6<=701959)|HS6==870821|HS4==8804|HS6==911390|HS6==940490|HS6==961210
replace Category="" if (HS4>= 5001 & HS4<= 5003)|(HS4>= 5101 & HS4<= 5103)|(HS4>= 5201 & HS4<= 5203)|(HS4>=5301 & HS4<=5302)
replace Category="Clothing" if HS2==61|HS2==62
replace Category= "Leather, footwear,etc" if HS2==40|HS2==41|(HS4>=4201 & HS4<=4205)|(HS4>=4302 & HS4<=4304)|HS2==64|HS4==9605
replace Category= "" if (HS4>=4101 & HS4<=4103)|HS6==420212|HS6==420222|HS6==420232|HS6==420292|HS6==640520|HS6==640610
replace Category="Non-electrical Machinery" if (HS4>=7321 & HS4<=7322)|HS2==84|HS6==850860|HS6==852842|HS6==852852|HS6==852862|HS4==8608|HS4==8709
replace Category="" if (HS6>=846721 & HS6<=846729)
replace Category="Electrical Machinery" if (HS6>=846721 & HS6<=846729)|HS2==85|HS6==852352
replace Category="" if HS6== 850860|HS6==852842|HS6==852852|HS6==852862|(HS4>=8519 & HS4<=8523)
replace Category="Transport equipment" if HS2==86|(HS4>=8701 & HS4<=8708)|(HS4>=8711 &
HS4<=8714)|HS4==8716|(HS4>=8801 & HS4<=8803)|HS2==89
replace Category="" if HS4==8608|HS6==870821
replace Category= "Manufactures, not elsewhere specified" if HS4==2716|HS4==3406|(HS4>=3605 & HS4<=3606)|HS4==4206|HS2==46|(HS4>=6506 & HS4<=6507)|(HS4>=6602 & HS4<=6603)|HS2==67|HS4==6807|(HS4>=8304 & HS4<=8305)|(HS4>=8519 & HS4<=8523)|HS4==8710|HS4==8715|HS4==8805|(HS2>=90 & HS2<=93)|(HS4>=9405 & HS4<=9406)|HS2==95|HS2==96|HS2==97
replace Category="" if HS6==852352|HS4==9113|HS4==9605|HS6==961210|HS6==961900

*double counting HSCodes re-entry
replace Category= "Other agricultural products" if HS4==1802|HS4==3301|(HS6>=290543 & HS6<=290545)|HS6==380910|HS6==382460|(HS4>= 5001 & HS4<= 5003)|(HS4>= 5101 & HS4<= 5103)|HS4==5301|HS4==5302|(HS4>=4101 & HS4<=4103)
replace Category= "Leather, footwear,etc" if HS4==4102|HS4==9605
replace Category= "Minerals and Metals" if HS4==3403|HS4==9113
replace Category= "Oilseeds, Fats & Oils" if HS4==3823
replace Category= "Cotton" if (HS4>=5201 & HS4<=5203)
replace Category= "Textiles" if HS6==420212|HS6==420222|HS6==420232|HS6==420292|HS6==640520|HS6==640610|HS6==961210|HS6==870821
replace Category= "Non-electrical Machinery" if HS6==850860|HS6==852842|HS6==852852|HS6==852862|HS4==8608
replace Category = "Electrical Machinery" if HS6==852352
replace Category= "Wood, paper, etc" if HS6==961900

As you can see in the figure above, the variable “Category” has its respective category identification as per the HS Code identification of groups mentioned in the World Tariff Profiles. 

Now, given that we have the categorisation of the goods into different category, we don't need variables HS2, HS4 and HS6. Hence, drop them. Again, you can drop Unit and Quantity as per your need. Here, I will drop them.

drop HS2 HS4 HS6 Unit Quantity

Now, if you want to analyse the data in terms of only "Category", you will have to drop the variable Commodity and HS Code as well and also drop duplicates (in relation to Category).

bys Category: egen total =sum(ValuesRs)
duplicates drop Category, force
drop ValuesRs

The data should look like this;
Now you can export the data into an excel file. Use this command;

export excel “file name", firstrow(variables) replace 

I made the graph through Excel and it looked like this. A large chunk of Nepal’s total exports consisted of Textiles and Oilseeds, Fats & Olis. NRS billions 58.7 and 38.9 respectively, worth of goods were exported among these two category only. 


Monday, July 4, 2022

Russia-Ukraine War and Global Food Security

Right when the post-pandemic recovery was about to take a positive incline, Russian-Ukraine war has added an additional trauma to an already traumatized world economy with a forced supply crunch for multiple food and petroleum products. With numerous economic sanctions, geo-political tensions, supply chain disruptions and sky-high fuel prices beginning to be a new normal currently, the war is having a serious ripple effect. Especially by intensifying threats to global food security given that a large chunk of global food exports comes from Ukraine and Russia. 

Predicaments of War and South Asia

Russia and Ukraine rank among the top three exporters of wheat, barley, maize, and sunflower oil among others. Ukraine alone accounts for world’s one-third of barley export. Russia ranks first, second and third in the global export of nitrogen fertilizer, potassic fertilizers and phosphorous fertilizers respectively. Least developed Countries rely heavily on such fertilizers and food supplies from Ukraine and Russia. Many of the LDCs were already having issues with fertilizers shortages and food supply due to the pandemic and now, with the Ukraine-Russia war propelling their production and supply crunch, matters have been much worse for South Asia Countries. 

 

The export-import scenario of wheat across South Asian countries and Ukraine can be a fresh example. Bangladesh imports almost half of its wheat from Ukraine which is termed to be much cheaper import. A significant other chunk is imported from India. However, in reference to the current food shortage, India has implied a ban on wheat export. Given such situation, with both India and Ukraine out of option for wheat import, Bangladesh is forced to obtain wheat from expensive sellers. India’s stance on wheat export ban is heavily criticized by the WTO and many countries citing that such decisions would further worsen the food market, especially in low-income countries. Likewise, Pakistan imports 39% of its wheat from Ukraine and a significant chunk from Russia as well. Pakistan saw a record production of wheat last year, however, that is still termed to be insignificant to meet the demand and the target production for this year. Also, Fertilizer shortages have been a big concern in Pakistan and Nepal lately. In one of the western regions of Nepal, the farmers out of desperation took over the fertilizer trunk on route sent by the government to a respective body. Sri Lanka, on the other hand, is having the worst possible scenario any nation could have. Sri Lanka is basically in a fuel lockdown and its weak foreign currency and depleted reserves have made it the most vulnerable to food shortage. 

 

Not to forget, 60% of the world’s hungry people live in Asia and the people of South Asian countries include a significant chunk of those hungry people. 

 

Besides, the early prediction by the Food and Agriculture Organization (FAO) highlights that the global trade of food products are expected to decrease in 2022-23, especially food products like cereals, wheat and coarse grain among others. Subsequently, due to such shortages and debacles time and again, food prices and inflation in general have touched the roof which has made the situation even worse. 


Global Food Price Hike

Ever since the Russia-Ukraine war, the price levels for almost every good has touched the sky. When many countries tend to depend on a few countries for important goods on a daily basis, and when the countries upon which many depend are unable to supply the necessary goods, situation like that of today are bound to happen. However, it is alarming to see such a strong ripple effect. With the shortage of fuels and food products that are largely exported by Ukraine and Russia, many countries are forced to look for limited and expensive alternative options to meet the demand. However, given the extreme shortage, food and fertilizer prices have been higher than ever which is sharply noted in the figure below. 

  Source: FAO


Global Food Price Index (FPI) shows a very unsettling scenario if we look at its inclination since the pandemic. The figure above puts an effort to show pre-COVID, during COVID, pre-war and current status of global food prices. Initially, in 2019 the FDI index was at 95.1 on average. The FPI index floated around 95.1-95.5 during the first wave. With the pandemic tightly grasping the world economy, it’s quite positive to see that the food prices were relatively stable which could be largely due to the higher stocks left. However, as the pandemic moved towards the 2nd wave and that the stocks started to get thinner by the day, the FPI index showed an upward trend. During the 3rd wave between mid-January 2021 to mid-May 2021, it showed a steep incline. By this time in May, the FPI index had already boomed to 128.1. It’s a stark rise considering the fact that FPI saw an increase of 33 points (34 percent rise) since 2019 average. 

 

While pandemic had a huge effect on food price hike, the Russia-Ukraine war made it much worse. Although FPI was floating in an expensive price range during the pre-war period, it is quite evident through the graph that, right when the war kicked-off, the FPI showed a very steep upward incline within one month period. The FPI index rose to 159.7 from 141.1. That is 18.1 points (12.30 percent rise) which is immensely high considering the fact that FPI index rose by 6.2 points from February 2020 (beginning of pandemic) to November 2020 (end of second wave). To put into perspective, FPI index tripled within one month during the start of the war compared to a 9 month rise from the start of pandemic to the end of second wave. 


Year

Food Price Index

Meat Price Index

Dairy Price Index

Cereals Price Index

Oils Price Index

Sugar Price Index

2019

95.1

100.0

102.8

96.6

83.2

78.6

2020

98.1

95.5

101.8

103.1

99.4

79.5

2021

125.7

107.7

119.1

131.2

164.9

109.3

2022

150.4

117.6

141.7

159.8

221.3

116.6

Source: FAO


The table above shows a year-on-year FDI index along with the index of five daily food product category from 2019-2022 (till May). FPI saw an increase of 24.7 points from 2021 to 2022 May. From the pre covid period till May 2022, FPI saw an increase of 55.3 points (58.15 percent). Given the dire state of food security currently, the FPI index is likely to rise by the end of 2022. Between 2019-2022 May, Oil Price index jumped 138.1 points which is a 166% rise. Likewise, as mentioned earlier as well, Cereals price is expected to further increase in the future with an already rising state of 28.6 points from 2021-2022 May.

 

Policy Recommendation 

The 12th ministerial Conference held recently on June 12-15 by the World Trade Organization (WTO) has tried to address possible remedies for food insecurity. Restricting countries to impose export ban when traded for commercial humanitarian purpose to the world food programme is a welcome move. However, that can hardly address the current state of dire food security.

 

One of the most important steps would be to work on reducing heavy trade dependency on just a few countries. Its pertinent to look for alternative measures for those commodities that are massively exported on a daily basis like wheat, cereals, and rice among others. Having a wide array of importing option would immediately reduce vulnerability to exogenous shocks like the current war. Given that the LDCs are largely the ones facing the adverse effects of such shocks mostly due to their relatively low-coping mechanisms to shocks, it’s extremely important for LDCs to learn from current scenario and look for alternate options for future food security.

 

Likewise, while it is important to take relevant measures to meet the domestic demand, export ban of food products right when the food security is threatened should not be encouraged and avoided by developing and high-food-producing countries. Moreover, WTO and FAO should bring about measures and policies that help prevent such precarious actions.

 

Initiatives to support the most vulnerable groups is welcome and encouraged. Social incentives and protection programs towards food supply and security should be initiated so that it can help alleviate the effects of war to a certain extent. Importantly, it is even more pertinent to make sure these incentives and social protection programs reach the right audience in a timely manner after the incentives is passed by the relevant body. 


Above all, geo-political conflicts by default hampers food security. 2022 Global Report on Food Crisis underlines Conflict/insecurity to be one of the most important drivers of food crisis across all regions in 2021. For example, for all seven food crises in the Middle East, two out of three food crises in South Asia were caused largely due to conflict/insecurity. Disruptions of food production and daily stable living is reported to have driven many acute food crisis across many regions and such disruptions were propelled by conflict/insecurity. It’s pertinent to avoid such geo-political tensions and conflicts of various means that bring peril to regional food security.  

 

***This article is an edited and extended version of my own article published in Trade, Climate Change and Development Monitor Volume 19, Issue 06, a monthly E-newsletter of SAWTEE.