*=============================================================================== /* DATE: October 15, 2019 NAME: DOING BUSINESS HISTORICAL SCORES DO FILE. Three datasets are merged to calculate the scores: 1- Historical data.dta: Doing Business Historical dataset with individual component indicators since DB2004. 2- Best and worst performance.dta: File with worst and best performance for individual component indicators. 3- Weights.dta: Weights for economies with second cities. For each of the 11 economies where Doing Business collects data for the largest and the second largest business cities, the score is calculated as the population weighted average of the scores for these two cities. OUTPUT: Historical data file as published on the Doing Business website with historical scores. NOTES: The ease of doing business score measures an economy’s performance with respect to a measure of regulatory best practice across the entire sample of 41 indicators for 10 Doing Business topics. Calculating the ease of doing business score for each economy involves two main steps: 1- In the first step individual component indicators are normalized to a common unit where each of the 41 component indicators y (except for the total tax and contribution rate) is rescaled using the linear transformation (worst – y)/(worst – best). In this formulation the highest score represents the best regulatory performance on the indicator across all economies since 2005 or the third year in which data for the indicator were collected. Both the best regulatory performance and the worst regulatory performance are established every five years on the basis of the Doing Business data for the year in which they are established and remain at that level for the five years regardless of any changes in data in interim years. 2- the scores obtained for individual indicators for each economy are aggregated through simple averaging into one score, first for each topic and then across all 10 topics. Note that until 2018, "score" use to be referred to as "DTF" and "best" was sometimes referred to as "Frontier" Each methodology expansion was back-calculated for one year to provide comparable data for the previous year. */ *=============================================================================== clear set more off /* To user: Please update the directory (cd "...") and uplaod the main dataset: Historical data */ cd "" use "Historical-data.dta", clear /*============================================================================== STEP 1 SETTING UP BEST and WORST DATA TABLE - Extract scores parameters and convert into Stata suitable format. This step generates score denominators: Score (sub-indicator level) = ((WORST-Y) / ((WORST-BEST)*100) Score denominator = WORST - BEST Best and worst performance.dta (provided) dataset is used in this step.*/ *=============================================================================== preserve clear use "Best-and-worst-performance.dta" drop in 1 foreach var of varlist cod-contractsproceduresBunus{ tostring `var', replace } foreach var of varlist dtfparameter-contractsproceduresBunus{ assert `var' !=" " } foreach var of varlist startbusprocedures-contractsproceduresBunus{ generate double n`var'=real(`var') drop `var' rename n`var' `var' } foreach v of varlist cod economy region incomegroup { format `v' %15s } encode dtfparameter, g(dtfparameter2) drop dtfparameter rename dtfparameter2 dtfparameter order dtfparameter, after(dbyear) xpose, clear varname rename (v1 v2) (frontier worst) /* Generates "denominator2" for indicators where higher values are better (i.e., quality of land administration index) and "denominator" for indicators where lower values are better (i.e., number of days to start a business). */ gen denominator=worst-frontier if worst>frontier gen denominator2=frontier-worst if frontier>worst replace denominator= denominator2 if denominator==. drop denominator2 recode denominator (1=3) if _varname=="dtfparameter" xpose, clear label define dtfparameter 1 "Frontier" 2 "Worst Performance" 3 "DTF denominator", replace label values dtfparameter dtfparameter foreach var of varlist startbusprocedures-contractsproceduresBunus{ replace `var'=round(real(string(`var'*100, "%10.0g")),10)/100 recast double `var' replace `var'=round(`var',0.1) } save "DTF coefficients_DB20.dta", replace restore *=============================================================================== /* STEP 2 MERGE score coefficients from Step 1 with HISTORICAL DATA and create composite indicators.*/ *=============================================================================== foreach v of varlist cod economy region incomegroup { format `v' %15s } append using "DTF coefficients_DB20.dta", force order dtfparameter, after(dbyear) sort dtfparameter cod dbyear economy /* Creating composite indicators Getting Credit is composed of two measures: legal rights of borrowers and lenders and credit information.*/ g gettingcredit=creditrights+creditinformation6pnt5pr /* Methodology used for DB2004-DB2014*/ g gettingcreditnew=creditrights_new+creditinformation8pnt5pr /* New Methodology used for DB2015 and on*/ g economyVAT=-111 if taxesTimeComplyVATrefund==-111 & taxesTimeObtainVATrefund==-111 /* This creates dummy for economies with 'NO VAT'*/ replace electricityPriceperkWhUSD=electricityPriceperkWhUSD*100 recode electricityPriceperkWhUSD (-999900=-9999) replace region="High income: OECD" if economy=="Chile" order gettingcredit gettingcreditnew, after(creditinformation8pnt5pr) table dbyear, c(n gettingcredit n gettingcreditnew) sort cod dbyear economy order creditinformation6pnt5pr creditinformation8pnt5pr, after(creditrights_new) /* CREATING 'NO PRACTICE' DUMMIES */ foreach v of varlist startbuscapital-economyVAT { recode `v' (-1=-9999) g np`v'=-9999 if `v'==-9999 replace `v'=. if np`v'==-9999 } /*============================================================================== STEP 3 Calculating scores *===============================================================================*/ foreach v of varlist startbusprocedures startbustime startbuscost startbusproceduresW startbustimeW startbuscostW startbuscapital /// permitprocedures permittime permitcostWhV permitsLegalindex /// electricityprocedures electricitytime electricitycost electricitySAIDISAIFIscore /// registerprocedures registertime registercost registerLegalindexGener /// creditrights creditinformation6pnt5pr gettingcredit creditrights_new creditinformation8pnt5pr gettingcreditnew /// investorsProtectingMinInves investorsProtectingInv investorssuitsOld investorsdisclosure investorsliability investorssuits /// investorsrights investorsownership investorstransparency /// taxespayments taxestime /// tradingexportdocs tradingexporttime tradingimportdocs tradingimporttime ///* These are vars for Trading across Borders DB2006-DB2015 methodology.*/ tradingexportcost_def tradingimportcost_def /// tradeXcostborder tradeMcostborder tradeXtimeborder tradeMtimeborder ///* These are vars for Trading across Borders methodology for DB2016 and on.*//// tradeMcostdocs tradeMtimedocs tradeXcostdocs tradeXtimedocs /// contractstime contractscost /// contractsproceduresBunus contractsLegalindexGender /// closingrecovery closinglegal /// { local dtf="dtfparameter" /* Creating program for WORST and BEST dummy vars */ set type double gen `v'worst=`v' if `dtf'==2 su `v'worst if `v'worst~=. replace `v'worst=r(mean) gen `v'best=`v' if `dtf'==1 su `v'best if `v'best~=. replace `v'best=r(mean) gen `v'dtf=((`v'worst-`v')/(`v'worst-`v'best))*100 if `v'worst>`v'best /* If BEST <= Y <= WORST, then score (sub-indicator level) = ((WORST–-Y) / (WORST–-BEST))*100 */ replace `v'dtf=100 if `v'<=`v'best & `v'~=. & `v'worst>`v'best replace `v'dtf=0 if `v'>=`v'worst & `v'~=. & `v'worst>`v'best gen `v'dtf2=((`v'-`v'worst)/(`v'best-`v'worst))*100 if `v'worst<`v'best /* If WORST < = Y < = BEST, then score (sub-indicator level) = ((Y - WORST) / (BEST-WORST))*100 */ replace `v'dtf2=100 if `v'>=`v'best & `v'~=. & `v'worst<`v'best replace `v'dtf2=0 if `v'<=`v'worst & `v'~=. & `v'worst<`v'best replace `v'dtf=`v'dtf2 if `v'worst<`v'best drop `v'dtf2 } /* Paying Taxes (TTCR only)*/ foreach v of varlist taxestotal { local dtf="dtfparameter" set type double gen `v'worst=`v' if `dtf'==2 su `v'worst if `v'worst~=. replace `v'worst=r(mean) gen `v'best=`v' if `dtf'==1 su `v'best if `v'best~=. replace `v'best=r(mean) gen `v'dtf=(((`v'worst-`v')/(`v'worst-`v'best))^0.8)*100 replace `v'dtf=100 if `v'<=`v'best & `v'~=. replace `v'dtf=0 if `v'>=`v'worst & `v'~=. } /* Paying Taxes (POSTFILING data only)*/ foreach v of varlist taxesTimeComplyVATrefund taxesTimeObtainVATrefund { local dtf="dtfparameter" set type double gen `v'worst=`v' if `dtf'==2 su `v'worst if `v'worst~=. replace `v'worst=r(mean) gen `v'best=`v' if `dtf'==1 su `v'best if `v'best~=. replace `v'best=r(mean) gen `v'dtf=(((`v'worst-`v')/(`v'worst-`v'best)))*100 replace `v'dtf=100 if `v'<=`v'best & `v'~=. replace `v'dtf=0 if `v'>=`v'worst & `v'~=. replace `v'dtf=-111 if `v'==-111 /* This takes care of economies with 'NO VAT' */ replace `v'dtf=0 if `v'==-222 /* This takes care of economies with 'No VAT refund per case study scenario'*/ } foreach v of varlist taxesTimeCompleteCITaudit taxesTimeComplyCITaudit { local dtf="dtfparameter" set type double gen `v'worst=`v' if `dtf'==2 su `v'worst if `v'worst~=. replace `v'worst=r(mean) gen `v'best=`v' if `dtf'==1 su `v'best if `v'best~=. replace `v'best=r(mean) gen `v'dtf=(((`v'worst-`v')/(`v'worst-`v'best)))*100 replace `v'dtf=100 if `v'<=`v'best & `v'~=. replace `v'dtf=0 if `v'>=`v'worst & `v'~=. replace `v'dtf=0 if `v'==. & np`v'==-9999 /* This takes care of 'no practice' economies and a “no practice” economy receives a score of '0'*/ replace `v'dtf=-333 if `v'==-333 /* This takes care of economies with 'NO CIT' */ } gen noCIT=1 if taxesTimeComplyCITaudit==-333 gen noVAT=1 if economyVAT==-111 gen taxesPostfilingdtf =(taxesTimeComplyVATrefunddtf +taxesTimeObtainVATrefunddtf +taxesTimeComplyCITauditdtf +taxesTimeCompleteCITauditdtf)/4 replace taxesPostfilingdtf=(taxesTimeComplyCITauditdtf +taxesTimeCompleteCITauditdtf)/2 if noVAT==1 replace taxesPostfilingdtf=(taxesTimeComplyVATrefunddtf +taxesTimeObtainVATrefunddtf)/2 if noCIT==1 replace taxesPostfilingdtf=-5 if noVAT==1 & noCIT==1 replace nptaxesPostfiling=-9999 if nptaxespayments==-9999 /* This gives “no practice” economy a Postfiling score of '0' */ /* Adding back 'no practice'*/ foreach v of varlist startbusprocedures startbustime startbuscost startbusproceduresW startbustimeW startbuscostW startbuscapital permitprocedures permittime permitcostWhV permitsLegalindex electricityprocedures electricitytime electricitycost electricitySAIDISAIFIscore registerprocedures registertime registercost registerLegalindexGener creditrights creditinformation6pnt5pr gettingcredit creditrights_new creditinformation8pnt5pr gettingcreditnew investorsProtectingInv investorsProtectingMinInves investorssuitsOld investorsdisclosure investorsliability investorssuits investorsrights investorsownership investorstransparency taxespayments taxestime tradingexportdocs tradingexporttime tradingimportdocs tradingimporttime tradingexportcost_def tradingimportcost_def tradeXcostborder tradeMcostborder tradeXtimeborder tradeMtimeborder tradeMcostdocs tradeMtimedocs tradeXcostdocs tradeXtimedocs contractstime contractscost contractsLegalindexGender contractsproceduresBunus closingrecovery closinglegal taxestotal taxesTimeComplyVATrefund taxesTimeObtainVATrefund taxesTimeCompleteCITaudit taxesTimeComplyCITaudit taxesPostfiling { replace `v'dtf=0 if `v'==. & np`v'==-9999 /* This takes care of 'no practice' economies and a “no practice” economy receives a score of '0' */ } foreach v of varlist startbuscapital-economyVAT { replace `v'=-9999 if `v'==. & np`v'==-9999 /* This adds back 'no practice'*/ } drop if dtfparameter==1 | dtfparameter==2 | dtfparameter==3 drop *worst *best np* dtfparameter *************************************************************************************************** /* Generate aggregate score based on averages within (i.e. score for Registering Property based on 4 components), and then across ten components (Global score of a country based on 10 topics). Each methodology expansion was back-calculated for one year (except gender legal differences for Starting a Business, and the strength of insolvency framework index ) to provide comparable data for the previous year.*/ *************************************************************************************************** *Starting a Business* /* Methodology for DB2004 and on, takes into account gender legal differences for all years (values were back-calculated for all years)*/ gen DTFstartbus_gender =25/100*startbuscapitaldtf+ 12.5/100*(startbusproceduresdtf+startbustimedtf+startbuscostdtf+startbusproceduresWdtf+startbustimeWdtf+startbuscostWdtf) *Dealing with Construction Permits* /* DB2006-DB2015 methodology*/ gen DTFpermit_old =(permitproceduresdtf+permittimedtf+permitcostWhVdtf)/3 if dbyear<=2015 /* Methodology for DB2016 and on, takes into account the building quality control index*/ gen DTFpermit =(permitproceduresdtf+permittimedtf+permitcostWhVdtf+permitsLegalindexdtf)/4 *Getting Electricity* /* DB2010-DB2015 methodology*/ gen DTFelectricity_old =(electricityproceduresdtf+electricitytimedtf+electricitycostdtf)/3 if dbyear<=2015 /* Methodology for 2016 and on, takes into account the reliability of supply and transparency of tariffs index*/ gen DTFelectricity =(electricityproceduresdtf+electricitytimedtf+electricitycostdtf+electricitySAIDISAIFIscoredtf)/4 *Registering Property* /* DB2005-DB2015 methodology*/ gen DTFregister_old =(registerproceduresdtf+registertimedtf+registercostdtf)/3 if dbyear<=2015 /* Methodology for DB2017 and on, takes into account the quality of land administration index */ gen DTFregister_gender =(registerproceduresdtf+registertimedtf+registercostdtf+registerLegalindexGenerdtf)/4 *Getting Credit* /* DB2004-DB2014 methodology*/ gen DTFcredit_old =(gettingcreditdtf) /* Methodology for DB2015 and on*/ gen DTFcredit =(gettingcreditnewdtf) *Protecting Minority Investors* /* DB2004-DB2014 methodology*/ gen DTFinvestors_old =(investorsProtectingInvdtf) /* Methodology for DB2015 and on, takes into account shareholders’ rights in corporate governance beyond related-party transactions*/ gen DTFinvestors =(investorsProtectingMinInvesdtf) *Paying Taxes* /* DB2004-DB2016 methodology*/ gen DTFtaxes_old =(taxespaymentsdtf+taxestimedtf+taxestotaldtf)/3 if dbyear<=2016 /* Methodology for DB2017 and on, takes into account the postfiling index*/ gen DTFtaxes =(taxespaymentsdtf+taxestimedtf+taxestotaldtf+taxesPostfilingdtf)/4 replace DTFtaxes =(taxespaymentsdtf+taxestimedtf+taxestotaldtf)/3 if noVAT==1 & noCIT==1 /* Formula changes if neither VAT nor CIT applies. In these cases, the postfiling index is not included in the calculation of DTF score for Paying Taxes.*/ *Trading across Borders* /* DB2004-DB2015 methodology*/ gen DTFtradedef_old =(tradingexportdocsdtf+tradingexporttimedtf+tradingexportcost_defdtf+tradingimportdocsdtf+tradingimporttimedtf+tradingimportcost_defdtf)/6 /* Methodology for DB2016 and on, new case study assumptions and indicators*/ gen DTFtrade =(tradeXcostborderdtf+tradeMcostborderdtf+tradeXtimeborderdtf+tradeMtimeborderdtf+tradeMcostdocsdtf+tradeMtimedocsdtf+tradeXcostdocsdtf+tradeXtimedocsdtf)/8 *Enforcing Contracts* /* DB2004-DB2015 methodology*/ gen DTFcontracts_old =(contractstimedtf +contractscostdtf +contractsproceduresBunusdtf)/3 /* Methodology for DB2017 and on, takes into account the quality of judicial processes index*/ gen DTFcontracts_gender =(contractsLegalindexGenderdtf+contractstimedtf+contractscostdtf)/3 *Resolving Insolvency* /* DB2004 and on, takes into account the strength of insolvency framework index (values were back-calculated for all years)*/ gen DTFclosing =(closingrecoverydtf+closinglegaldtf)/2 ************************************************************************************************** /* STEP 4 : Calculating values for 11 parent economies In DB 2015, DB expanded the sample of cities in 11 large economies. For each of the 11 economies in which Doing Business collects data for both the largest and the second largest business cities, the score is calculated as the population weighted average of the scores for these two cities. The Weights.dta dataset (provided) is used in this step.*/ ************************************************************************************************** drop if cod=="BANG" | cod=="BRAZ" | cod=="CHIN" | cod=="INDI" | cod=="INDO" | cod=="JAP" | cod=="MEXI" | cod=="NIGE" | cod=="PAKI" | cod=="RUSS" | cod=="US" tab dbyear, m preserve gen twocities = 0 replace twocities = 1 if strmatch(cod, "BGD*") replace twocities = 2 if strmatch(cod, "BRA*") replace twocities = 3 if strmatch(cod, "CHN*") replace twocities = 4 if strmatch(cod, "IND*") replace twocities = 5 if strmatch(cod, "IDN*") replace twocities = 6 if strmatch(cod, "JPN*") replace twocities = 7 if strmatch(cod, "MEX*") replace twocities = 8 if strmatch(cod, "NGA*") replace twocities = 9 if strmatch(cod, "PAK*") replace twocities = 10 if strmatch(cod, "RUS*") replace twocities = 11 if strmatch(cod, "USA*") keep if twocities != 0 & dbyear > 2013 /*second cities data were added starting in DB2015, back-calulated one year to DB2014*/ gen callid = cod + string(dbyear) merge 1:1 callid using "Weights.dta" /* Assigns correct weights to cities*/ /*Merges 2 cities to obtain country level data*/ collapse start* permit* register* credit* investor* taxes* /// trad* contracts* closing* electri* DTF* get* [pw=weights] , by (twocities dbyear) save "Merged cities 2014 and up.dta" , replace /* this second step is used to add data to parent economies for variables for which the data is now available prior to DB2015 when second cities were added. Before DB2015, the data for parent economies are only available for the following: paid-in minimum capital for Starting a Business, Protecting Minority Investors, and the strength of insolvency framework index*/ restore preserve gen twocities = 0 replace twocities = 1 if strmatch(cod, "BGD*") replace twocities = 2 if strmatch(cod, "BRA*") replace twocities = 3 if strmatch(cod, "CHN*") replace twocities = 4 if strmatch(cod, "IND*") replace twocities = 5 if strmatch(cod, "IDN*") replace twocities = 6 if strmatch(cod, "JPN*") replace twocities = 7 if strmatch(cod, "MEX*") replace twocities = 8 if strmatch(cod, "NGA*") replace twocities = 9 if strmatch(cod, "PAK*") replace twocities = 10 if strmatch(cod, "RUS*") replace twocities = 11 if strmatch(cod, "USA*") keep if twocities != 0 & dbyear <2014 /* this step is only applicable to DB2013 and earlier*/ gen callid = cod + string(dbyear) merge 1:1 callid using "Weights.dta" /* Assigns correct weights to cities*/ /*Merges 2 cities to obtain country level data*/ collapse startbuscapital startbuscapitaldtf investor* DTFinvestors DTFinvestors_old closing_SI_Commencement closing_SI_ManagementAssets /// closing_SI_Reorganization closing_SI_CreditorParticipate closinglegal closinglegaldtf [pw=weights] , by (twocities dbyear) save "Merged cities back.dta",replace /*append to main dataset*/ restore append using "Merged cities back.dta" append using "Merged cities 2014 and up.dta" replace cod = "BANG" if twocities==1 replace cod = "BRAZ" if twocities==2 replace cod = "CHIN" if twocities==3 replace cod = "INDI" if twocities==4 replace cod = "INDO" if twocities==5 replace cod = "JAP" if twocities==6 replace cod = "MEXI" if twocities==7 replace cod = "NIGE" if twocities==8 replace cod = "PAKI" if twocities==9 replace cod = "RUSS" if twocities==10 replace cod = "US" if twocities==11 replace economy = "Bangladesh" if twocities==1 replace economy = "Brazil" if twocities==2 replace economy = "China" if twocities==3 replace economy = "India" if twocities==4 replace economy = "Indonesia" if twocities==5 replace economy = "Japan" if twocities==6 replace economy = "Mexico" if twocities==7 replace economy = "Nigeria" if twocities==8 replace economy = "Pakistan" if twocities==9 replace economy = "Russian Federation" if twocities==10 replace economy = "United States" if twocities==11 replace region = "South Asia" if twocities==1 replace region = "Latin America & Caribbean" if twocities==2 replace region = "East Asia & Pacific" if twocities==3 replace region = "South Asia" if twocities==4 replace region = "East Asia & Pacific" if twocities==5 replace region = "High income: OECD" if twocities==6 replace region = "Latin America & Caribbean" if twocities==7 replace region = "Sub-Saharan Africa" if twocities==8 replace region = "South Asia" if twocities==9 replace region = "Europe & Central Asia" if twocities==10 replace region = "High income: OECD" if twocities==11 replace incomegroup = "Lower middle income" if twocities==1 replace incomegroup = "Upper middle income" if twocities==2 replace incomegroup = "Upper middle income" if twocities==3 replace incomegroup = "Lower middle income" if twocities==4 replace incomegroup = "Lower middle income" if twocities==5 replace incomegroup = "High income" if twocities==6 replace incomegroup = "Upper middle income" if twocities==7 replace incomegroup = "Lower middle income" if twocities==8 replace incomegroup = "Lower middle income" if twocities==9 replace incomegroup = "Upper middle income" if twocities==10 replace incomegroup = "High income" if twocities==11 //gen callid = cod + string(dbyear) order cod economy region incomegroup dbyear drop twocities drop if startbuscapital==. sort cod dbyear economy tab dbyear, m *************************************************************************************************** /* For the GLOBAL score, each economy is aggregated through simple averaging into one score across all 10 topics, and computations take into account methodology changes. The "ease of doing business score" historical data are included starting in DB2010 when the last topic, getting electricity, was added.*/ *************************************************************************************************** /* Computation of the global score with electricity for DB10 to DB2014. */ gen DTFdb1014_global=(DTFstartbus_gender +DTFpermit_old +DTFelectricity_old +DTFregister_old +DTFcredit_old +DTFinvestors_old +DTFtaxes_old +DTFtradedef_old +DTFcontracts_old +DTFclosing)/10 /* if dbyear<2015 */ /* Computation of the global score for DB2014 and DB2015, unsing DB2015 methodology. 2 topics (Getting Credit, Protecting Minority Investors) broadened the existing measures*/ gen DTFdb1415_global=(DTFstartbus_gender +DTFpermit_old +DTFelectricity_old +DTFregister_old +DTFcredit +DTFinvestors +DTFtaxes_old +DTFtradedef_old +DTFcontracts_old +DTFclosing)/10 /* if dbyear==2014 | dbyear==2015 */ /* Computation of the global score for DB2016-2019 methodology - current methodogy. DB2016: 4 topics (Dealing with Construction Permits, Getting Electricity, Registering Property and Enforcing Contracts) introduced new measures of quality. Additionally, Trading across Borders overhauled its methodology to increase the relevance of indicators. DB2017: expanded the Paying taxes indicator */ gen DTFdb1620_global=(DTFstartbus_gender +DTFcontracts_gender +DTFregister_gender +DTFpermit +DTFelectricity +DTFcredit +DTFinvestors +DTFtaxes +DTFtrade +DTFclosing)/10 /* if dbyear>2015 */ *************************************************************************************************** //////// STEP 5 * GLOBAL RANK FOR DB2020* //////// *************************************************************************************************** g sample190=1 /* ranking is based on 190 economies. This variable is used to remove city level data for 11 economies with two cities from the ranking (instead, aggregated scores for the 11 economies are used). In DB2020, the ranking for Liechtenstein is also removed*/ replace sample190=. if cod=="BGD" | cod=="BGD_Chit" | cod=="BRA" | cod=="BRA_Rio" | cod=="CHN" | cod=="CHN_Beij" | cod=="IDN" | cod=="IDN_Sura" | cod=="IND" | cod=="IND_Delh" | cod=="JPN" | cod=="JPN_Osak" | cod=="MEX" | cod=="MEX_Mont" | cod=="NGA" | cod=="NGA_Kano" | cod=="PAK" | cod=="PAK_Laho" | cod=="RUS" | cod=="RUS_Sai" | cod=="USA" | cod=="USA_Losa" |cod=="LIE" /* the dataset also includes data for Liechtenstein, however, Liechtenstein is not included in the ranking in DB2020 */ foreach v of varlist DTFcredit { recast double DTFcredit gen DTFcredit1=round(DTFcredit,.00001) } bysort dbyear: egen GlobalRankDB1718= rank(DTFdb1620_global) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankStarting1718= rank(DTFstartbus_gender) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankPermit1718= rank(DTFpermit) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankElectricity1718= rank(DTFelectricity) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankRegister1718= rank(DTFregister_gender) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankCredit1718= rank(DTFcredit1) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankInvestors1718= rank(DTFinvestors) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankTaxes1718= rank(DTFtaxes) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankTrade1718= rank(DTFtrade) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankContracts1718= rank(DTFcontracts_gender) if sample190==1 & dbyear>2019 , field bysort dbyear: egen RankClosing1718= rank(DTFclosing) if sample190==1 & dbyear>2019 , field drop DTFcredit1 ************************************************************************************************** ////////* Formatting/application of decimal rules*////// ************************************************************************************************** foreach v of varlist startbuscost startbuscostW startbuscapital permitcostWhV electricitycost electricityPriceperkWhUSD registercost creditinformationCoverPublic creditinformationCoverPrivate taxestotal taxesTTRprofit taxesTTRlabor taxesTTROther contractscost contracts_attorney_fee contracts_court_fee contracts_enforcement_fee closingtime_web closingcostpercentage closingrecovery { replace `v'=round(real(string(`v'*100, "%10.0g")),10)/100 format `v' %10.0g replace `v'=round(`v',.1) } foreach v of varlist startbusproceduresdtf-taxestotaldtf taxesPostfilingdtf DTF* { format `v' %10.0g replace `v'=round(`v',.00001) } foreach v of varlist startbuscapital-RankClosing1718 { format `v' %10.0g } ************************************************************************************************** ////////* Creating Excel file with score data in the long format*////// ************************************************************************************************** ///*** LABELING VARIABLES FOR DISPLAY ON THE WEB ***/// label var cod "Country code" label var economy "Economy" label var dbyear "DB Year" label var region "Region" label var incomegroup "Income group" label var startbusprocedures "Procedures - Men (number)" label var startbustime "Time - Men (days)" label var startbuscost "Cost - Men (% of income per capita)" label var startbusproceduresW "Procedures - Women (number)" label var startbustimeW "Time - Women (days)" label var startbuscostW "Cost - Women (% of income per capita)" label var startbuscapital "Paid-in Minimum capital (% of income per capita)" label var permitprocedures "Procedures (number)" label var permittime "Time (days)" label var permitcostWhV "Cost (% of Warehouse value)" label var permitsLegalindex "Building quality control index (0-15) (DB16-20 methodology)" label var permits_SI_Buildregulation "Quality of building regulations index (0-2) (DB16-20 methodology)" label var permits_SI_Beforeconstr "Quality control before construction index (0-1) (DB16-20 methodology)" label var permits_SI_Duringconst "Quality control during construction index (0-3) (DB16-20 methodology)" label var permits_SI_Afterconst "Quality control after construction index (0-3) (DB16-20 methodology)" label var permits_SI_Liability "Liability and insurance regimes index (0-2) (DB16-20 methodology)" label var permits_SI_Certifications "Professional certifications index (0-4) (DB16-20 methodology)" label var electricityprocedures "Procedures (number)" label var electricitytime "Time (days)" label var electricitycost "Cost (% of income per capita)" label var electricitySAIDISAIFIscore "Reliability of supply and transparency of tariff index (0-8) (DB16-20 methodology)" label var electricityPriceperkWhUSD "Price of electricity (US cents per kWh) (DB16-20 methodology)" label var electricitySaidiSaifiPoints "Total duration and frequency of outages per customer a year (0-3) (DB16-20 methodology)" label var electricitySaidiIndex "System average interruption duration index (SAIDI) (DB16-20 methodology)" label var electricitySaifiIndex "System average interruption frequency index (SAIFI) (DB16-20 methodology)" label var electricityMinimumOutage "Minimum outage time (in minutes) (DB16-20 methodology)" label var electricityOutagemoniscore "Mechanisms for monitoring outages (0-1) (DB16-20 methodology)" label var electricityOutagerestoscore "Mechanisms for restoring service (0-1) (DB16-20 methodology)" label var electricityRegulatormoniscore "Regulatory monitoring (0-1) (DB16-20 methodology)" label var electricityCompensationscore "Financial deterrents aimed at limiting outages (0-1) (DB16-20 methodology)" label var electricityTransparencyscore "Communication of tariffs and tariff changes (0-1) (DB16-20 methodology)" label var registerprocedures "Procedures (number)" label var registertime "Time (days)" label var registercost "Cost (% of property value)" label var registerLegalindexGener "Quality of land administration index (0-30) (DB17-20 methodology)" label var registerReliabilityInfrast "Reliability of infrastructure index (0-8) (DB17-20 methodology)" label var registerTransparency "Transparency of information index (0-6) (DB17-20 methodology)" label var registerCoverage "Geographic coverage index (0-8) (DB17-20 methodology)" label var registerLegalBackground "Land dispute resolution index (0-8) (DB17-20 methodology)" label var registerWEBEqualAccess "Equal access to property rights index (-2-0) (DB17-20 methodology)" label var creditrights "Strength of legal rights index (0-10) (DB05-14 methodology)" label var creditrights_new "Strength of legal rights index (0-12) (DB15-20 methodology) " label var creditinformation6pnt5pr "Depth of credit information index (0-6) (DB05-14 methodology)" label var creditinformation8pnt5pr "Depth of credit information index (0-8) (DB15-20 methodology) " label var creditinformationCoverPublic "Credit registry coverage (% of adults)" label var creditinformationCoverPrivate "Credit bureau coverage (% of adults)" label var gettingcredit "Getting Credit total score (DB05-14 methodology)" label var gettingcreditnew "Getting Credit total score (DB15-20 methodology) " label var investorssuitsOld "Ease of shareholder suits index (0-10) (DB06-14 methodology)" label var investorsdisclosure "Extent of disclosure index (0-10)" label var investorsliability "Extent of director liability index (0-10)" label var investorssuits "Ease of shareholder suits index (0-10) (DB15-20 methodology) " label var investorsrights "Extent of shareholder rights index (0-6) (DB15-20 methodology) " label var investorsownership "Extent of ownership and control index (0-7) (DB15-20 methodology) " label var investorstransparency "Extent of corporate transparency index (0-7) (DB15-20 methodology) " label var investorsProtectingInv "Strength of investor protection index (0-30) (DB06-14 methodology)" label var investorsProtectingMinInves "Strength of minority investor protection index (0-50) (DB15-20 methodology) " label var tradeXtimedocs "Time to export: Documentary compliance (hours) (DB16-20 methodology)" label var tradeMtimedocs "Time to import: Documentary compliance (hours) (DB16-20 methodology)" label var tradeXtimeborder "Time to export: Border compliance (hours) (DB16-20 methodology)" label var tradeMtimeborder "Time to import: Border compliance (hours) (DB16-20 methodology)" label var tradeXcostdocs "Cost to export: Documentary compliance (USD) (DB16-20 methodology)" label var tradeMcostdocs "Cost to import: Documentary compliance (USD) (DB16-20 methodology)" label var tradeXcostborder "Cost to export: Border compliance (USD) (DB16-20 methodology)" label var tradeMcostborder "Cost to import: Border compliance (USD) (DB16-20 methodology)" label var tradingexportdocs "Documents to export (number) (DB06-15 methodology)" label var tradingimportdocs "Documents to import (number) (DB06-15 methodology)" label var tradingexportcost_def "Cost to export (US$ per container deflated) (DB06-15 methodology)" label var tradingexporttime "Time to export (days) (DB06-15 methodology)" label var tradingimportcost_def "Cost to import (US$ per container deflated) (DB06-15 methodology)" label var tradingimporttime "Time to import (days) (DB06-15 methodology)" label var contracts_filing_days "Filing and service (days)" label var contracts_trial_days "Trial and judgment (days)" label var contracts_enforcement_days "Enforcement of judgment (days)" label var contracts_attorney_fee "Attorney fees (% of claim)" label var contracts_court_fee "Court fees (% of claim)" label var contracts_enforcement_fee "Enforcement fees (% of claim)" label var contractsproceduresBunus "Procedures (number) (DB04-15 methodology)" label var contractstime "Time (days)" label var contractscost "Cost (% of claim)" label var contractsLegalindexGender "Quality of judicial processes index (0-18) (DB17-20 methodology)" label var contracts_SI_CourtStructureGen "Court structure and proceedings (0-5) (DB17-20 methodology)" label var contracts_SI_CaseManagement "Case management (0-6) (DB17-20 methodology)" label var contracts_SI_CourtAutomation "Court automation (0-4) (DB17-20 methodology)" label var contracts_SI_ADR "Alternative dispute resolution (0-3) (DB17-20 methodology)" label var closingtime_web "Time (years)" label var closingrecovery "Recovery rate (cents on the dollar)" label var closingcostpercentage "Cost (% of estate)" label var closinglegal "Strength of insolvency framework index (0-16)" label var closingOutcome "Outcome (0 as piecemeal sale and 1 as going concern)" label var closing_SI_Commencement "Commencement of proceedings index (0-3) (DB15-20 methodology)" label var closing_SI_ManagementAssets "Management of debtor's assets index (0-6) (DB15-20 methodology)" label var closing_SI_Reorganization "Reorganization proceedings index (0-3) (DB15-20 methodology)" label var closing_SI_CreditorParticipate "Creditor participation index (0-4) (DB15-20 methodology)" label var taxespayments "Payments (number per year)" label var taxestime "Time (hours per year)" label var taxestotal "Total tax and contribution rate (% of profit)" label var taxesTTRprofit "Profit tax (% of profit)" label var taxesTTRlabor "Labor tax and contributions (% of profit)" label var taxesTTROther "Other taxes (% of profit)" label var taxesTimeComplyVATrefund "Time to comply with VAT refund (hours) (DB17-20 methodology)" label var taxesTimeObtainVATrefund "Time to obtain VAT refund (weeks) (DB17-20 methodology)" label var taxesTimeComplyCITaudit "Time to comply with a corporate income tax correction (hours) (DB17-20 methodology)" label var taxesTimeCompleteCITaudit "Time to complete a corporate income tax correction (weeks) (DB17-20 methodology)" ///*** LABELING SCORE VARIABLES FOR DISPLAY ON THE WEB ***/// label var GlobalRankDB1718 "Ease of doing business rank" label var DTFdb1620_global "Ease of doing business score (DB17-20 methodology)" label var DTFdb1415_global "Ease of doing business score (DB15 methodology)" label var DTFdb1014_global "Ease of doing business score (DB10-14 methodology)" label var RankStarting1718 "Rank-Starting a business" label var DTFstartbus_gender "Score-Starting a business" label var startbusproceduresdtf "Score-Procedures - Men (number)" label var startbustimedtf "Score-Time - Men (days)" label var startbuscostdtf "Score-Cost - Men (% of income per capita)" label var startbusproceduresWdtf "Score-Procedures - Women (number)" label var startbustimeWdtf "Score-Time - Women (days)" label var startbuscostWdtf "Score-Cost - Women (% of income per capita)" label var startbuscapitaldtf "Score-Paid-in Minimum capital (% of income per capita)" label var RankPermit1718 "Rank-Dealing with construction permits" label var DTFpermit "Score-Dealing with construction permits (DB16-20 methodology)" label var DTFpermit_old "Score-Dealing with construction permits (DB06-15 methodology)" label var permitproceduresdtf "Score-Procedures (number)" label var permittimedtf "Score-Time (days)" label var permitcostWhVdtf "Score-Cost (% of Warehouse value)" label var permitsLegalindexdtf "Score-Building quality control index (0-15) (DB16-20 methodology)" label var RankElectricity1718 "Rank-Getting electricity" label var DTFelectricity "Score-Getting electricity (DB16-20 methodology)" label var DTFelectricity_old "Score-Getting electricity (DB10-15 methodology)" label var electricityproceduresdtf "Score-Procedures (number)" label var electricitytimedtf "Score-Time (days)" label var electricitycostdtf "Score-Cost (% of income per capita)" label var electricitySAIDISAIFIscoredtf "Score-Reliability of supply and transparency of tariff index (0-8) (DB16-20 methodology)" label var RankRegister1718 "Rank-Registering property" label var DTFregister_gender "Score-Registering property (DB17-20 methodology)" label var DTFregister_old "Score-Registering property (DB05-15 methodology)" label var registerproceduresdtf "Score-Procedures (number)" label var registertimedtf "Score-Time (days)" label var registercostdtf "Score-Cost (% of property value)" label var registerLegalindexGenerdtf "Score-Quality of land administration index(0-30)(DB17-20 methodology)" label var DTFcredit "Score-Getting credit (DB15-20 methodology)" label var DTFcredit_old "Score-Getting credit (DB05-14 methodology)" label var RankCredit1718 "Rank-Getting credit" label var creditrightsdtf "Score-Strength of legal rights index (0-10) (DB05-14 methodology)" label var creditinformation6pnt5prdtf "Score-Depth of credit information index (0-6) (DB05-14 methodology)" label var creditrights_newdtf "Score-Strength of legal rights index (0-12) (DB15-20 methodology) " label var creditinformation8pnt5prdtf "Score-Depth of credit information index (0-8) (DB15-20 methodology) " label var RankInvestors1718 "Rank-Protecting minority investors" label var DTFinvestors "Score-Protecting minority investors (DB15-20 methodology)" label var DTFinvestors_old "Score-Protecting minority investors (DB06-14 methodology)" label var investorsdisclosuredtf "Score-Extent of disclosure index (0-10)" label var investorsliabilitydtf "Score-Extent of director liability index (0-10)" label var investorssuitsOlddtf "Score-Ease of shareholder suits index (0-10) (DB06-14 methodology)" label var investorssuitsdtf "Score-Ease of shareholder suits index (0-10) (DB15-20 methodology)" label var investorsrightsdtf "Score-Extent of shareholder rights index (0-6) (DB15-20 methodology)" label var investorsownershipdtf "Score-Extent of ownership and control index (0-7) (DB15-20 methodology)" label var investorstransparencydtf "Score-Extent of corporate transparency index (0-7) (DB15-20 methodology)" label var RankTaxes1718 "Rank-Paying taxes" label var DTFtaxes "Score-Paying taxes (DB17-20 methodology)" label var DTFtaxes_old "Score-Paying taxes (DB06-16 methodology)" label var taxesPostfilingdtf "Score-Postfiling index (0-100) (DB17-20 methodology)" label var taxespaymentsdtf "Score-Payments (number per year)" label var taxestimedtf "Score-Time (hours per year)" label var taxestotaldtf "Score-Total tax and contribution rate (% of profit)" label var taxesTimeComplyVATrefunddtf "Score-Time to comply with VAT refund (hours) (DB17-20 methodology)" label var taxesTimeObtainVATrefunddtf "Score-Time to obtain VAT refund (weeks) (DB17-20 methodology)" label var taxesTimeComplyCITauditdtf "Score-Time to comply with a corporate income tax correction (hours) (DB17-20 methodology)" label var taxesTimeCompleteCITauditdtf "Score-Time to complete a corporate income tax correction (weeks) (DB17-20 methodology)" label var RankTrade1718 "Rank-Trading across borders" label var DTFtrade "Score-Trading across borders (DB16-20 methodology)" label var DTFtradedef_old "Score-Trading across borders (DB06-15 methodology)" label var tradingexportdocsdtf "Score-Documents to export (number) (DB06-15 methodology)" label var tradingimportdocsdtf "Score-Documents to import (number) (DB06-15 methodology)" label var tradingexporttimedtf "Score-Time to export (days) (DB06-15 methodology)" label var tradingimporttimedtf "Score-Time to import (days) (DB06-15 methodology)" label var tradingexportcost_defdtf "Score-Cost to export (US$ per container deflated) (DB06-15 methodology)" label var tradingimportcost_defdtf "Score-Cost to import (US$ per container deflated) (DB06-15 methodology)" label var tradeXtimeborderdtf "Score-Time to export: Border compliance (hours) (DB16-20 methodology)" label var tradeMtimeborderdtf "Score-Time to import: Border compliance (hours) (DB16-20 methodology)" label var tradeXtimedocsdtf "Score-Time to export: Documentary compliance (hours) (DB16-20 methodology)" label var tradeMtimedocsdtf "Score-Time to import: Documentary compliance (hours) (DB16-20 methodology)" label var tradeXcostborderdtf "Score-Cost to export: Border compliance (USD) (DB16-20 methodology)" label var tradeMcostborderdtf "Score-Cost to import: Border compliance (USD) (DB16-20 methodology)" label var tradeXcostdocsdtf "Score-Cost to export: Documentary compliance (USD) (DB16-20 methodology)" label var tradeMcostdocsdtf "Score-Cost to import: Documentary compliance (USD) (DB16-20 methodology)" label var RankContracts1718 "Rank-Enforcing contracts" label var DTFcontracts_gender "Score-Enforcing contracts (DB17-20 methodology)" label var DTFcontracts_old "Score-Enforcing contracts (DB04-15 methodology)" label var contractsproceduresBunusdtf "Score-Procedures (number) (DB04-15 methodology)" label var contractstimedtf "Score-Time (days)" label var contractscostdtf "Score-Cost (% of claim)" label var contractsLegalindexGenderdtf "Score-Quality of judicial processes index (0-18) (DB17-20 methodology)" label var RankClosing1718 "Rank-Resolving insolvency" label var DTFclosing "Score-Resolving insolvency" label var closingrecoverydtf "Score-Recovery rate (cents on the dollar)" label var closinglegaldtf "Score-Strength of insolvency framework index (0-16)" ///*** ORDER OF DATA POINTS FOR DISPLAY ON THE WEB ***/// order cod economy region incomegroup dbyear GlobalRankDB1718 DTFdb1620_global DTFdb1415_global DTFdb1014_global, first /* 1. STARTING A BUSINESS */ order RankStarting1718 DTFstartbus_gender, after(DTFdb1014_global) order startbusprocedures startbusproceduresdtf startbustime startbustimedtf startbuscost /// startbuscostdtf startbusproceduresW startbusproceduresWdtf /// startbustimeW startbustimeWdtf startbuscostW startbuscostWdtf startbuscapital startbuscapitaldtf, after(DTFstartbus_gender) /* 2. DEALING WITH CONSTRUCTION PERMITS */ order RankPermit1718 DTFpermit DTFpermit_old, after(startbuscapitaldtf) order permitprocedures permitproceduresdtf permittime permittimedtf permitcostWhV permitcostWhVdtf permitsLegalindex permitsLegalindexdtf /// permits_SI_Buildregulation permits_SI_Beforeconstr permits_SI_Duringconst permits_SI_Afterconst permits_SI_Liability permits_SI_Certifications, after(DTFpermit_old) /* 3. GETTING ELECTRICITY */ order RankElectricity1718 DTFelectricity DTFelectricity_old, after(permits_SI_Certifications) order electricityprocedures electricityproceduresdtf electricitytime electricitytimedtf electricitycost electricitycostdtf electricitySAIDISAIFIscore electricitySAIDISAIFIscoredtf /// electricitySaidiSaifiPoints electricityOutagemoniscore electricityOutagerestoscore electricityRegulatormoniscore electricityCompensationscore electricityTransparencyscore /// electricitySaidiIndex electricitySaifiIndex electricityMinimumOutage electricityPriceperkWhUSD, after(DTFelectricity_old) /* 4. REGISTERING PROPERTY */ order RankRegister1718 DTFregister_gender DTFregister_old, after(electricityPriceperkWhUSD) order registerprocedures registerproceduresdtf registertime registertimedtf registercost registercostdtf registerLegalindexGener /// registerLegalindexGenerdt registerReliabilityInfrast registerTransparency registerCoverage registerLegalBackground registerWEBEqualAccess, after(DTFregister_old) /* 5. GETTING CREDIT */ order RankCredit1718 DTFcredit DTFcredit_old, after(registerWEBEqualAccess) order creditrights creditrightsdtf creditinformation6pnt5pr creditinformation6pnt5prdtf gettingcredit /// creditrights_new creditrights_newdtf creditinformation8pnt5pr creditinformation8pnt5prdtf gettingcreditnew creditinformationCoverPublic /// creditinformationCoverPrivate, after(DTFcredit_old) /* 6. PROTECTING MINORITY INVESTORS */ order RankInvestors1718 DTFinvestors DTFinvestors_old, after(creditinformationCoverPrivate) order investorsdisclosure investorsdisclosuredtf investorsliability investorsliabilitydtf investorssuitsOld investorssuitsOlddtf /// investorsProtectingInv investorssuits investorssuitsdtf investorsrights investorsrightsdtf investorsownership investorsownershipdtf /// investorstransparency investorstransparencydtf investorsProtectingMinInves, after(DTFinvestors_old) /* 7. PAYING TAXES */ order RankTaxes1718 DTFtaxes DTFtaxes_old, after(investorsProtectingMinInves) /// order taxespayments taxespaymentsdtf taxestime taxestimedtf taxestotal taxestotaldtf /// taxesTTRprofit taxesTTRlabor taxesTTROther taxesTimeComplyVATrefund taxesTimeComplyVATrefunddtf /// taxesTimeObtainVATrefund taxesTimeObtainVATrefunddtf taxesTimeComplyCITaudit /// taxesTimeComplyCITauditdtf taxesTimeCompleteCITaudit taxesTimeCompleteCITauditdtf /// taxesPostfilingdtf, after(DTFtaxes_old) /* 8. TRADING ACROSS BORDERS */ /* NEW */ order RankTrade1718 DTFtrade DTFtradedef_old, after(taxesPostfilingdtf) order tradeXtimedocs tradeXtimedocsdtf tradeMtimedocs tradeMtimedocsdtf /// tradeXtimeborder tradeXtimeborderdtf tradeMtimeborder tradeMtimeborderdtf /// tradeXcostdocs tradeXcostdocsdtf tradeMcostdocs tradeMcostdocsdtf /// tradeXcostborder tradeXcostborderdtf tradeMcostborder tradeMcostborderdtf, after(DTFtradedef_old) /* OLD */ order tradingexportdocs tradingexportdocsdtf tradingimportdocs tradingimportdocsdtf /// tradingexportcost_def tradingexportcost_defdtf tradingimportcost_def tradingimportcost_defdtf /// tradingexporttime tradingexporttimedtf tradingimporttime tradingimporttimedtf, after(tradeMcostborderdtf) /* 9. ENFORCING CONTRACTS */ order RankContracts1718 DTFcontracts_gender DTFcontracts_old, after(tradingimporttimedtf) order contractsproceduresBunus contractsproceduresBunusdtf contractstime contractstimedtf /// contracts_filing_days contracts_trial_days contracts_enforcement_days /// contractscost contractscostdtf contracts_attorney_fee contracts_court_fee contracts_enforcement_fee /// contractsLegalindexGender contractsLegalindexGenderdtf contracts_SI_CourtStructureGen /// contracts_SI_CaseManagement contracts_SI_CourtAutomation contracts_SI_ADR, after(DTFcontracts_old) /* 10. RESOLVING INSOLVENCY */ order RankClosing1718 DTFclosing, after(contracts_SI_ADR) order closingOutcome closingtime_web closingcostpercentage closingrecovery closingrecoverydtf /// closinglegal closinglegaldtf closing_SI_Commencement closing_SI_ManagementAssets /// closing_SI_Reorganization closing_SI_CreditorParticipate, after(DTFclosing) /// ///*** LABELING SPECIAL VALUES (ie. 'No Practice', etc....) ***/// foreach v of varlist electricitySaidiIndex electricitySaifiIndex { replace `v'= -4 if cod=="NIGE" & dbyear>2014 } replace electricityMinimumOutage=-3 if cod=="NIGE" & dbyear>2014 & dbyear<2018 label drop status label define status -22 "##" -3 "N/A" -4 ".." -5 " " -9999 "No Practice" -111 "No VAT" -222 "No VAT refund per case study scenario" -333 "No corporate income tax" foreach var of varlist start* permit* electr* regist* credit* invest* trad* contr* closin* tax* { label values `var' status format `var' %10.0g } recode registerWEBEqualAccess (-9999=-1) if DTFregister_gender!=0 drop creditinformation6pnt economyVAT noCIT noVAT tradeprocedures tradingexportcost tradingimportcost closingtime gettingcreditdtf sample190 gettingcreditnewdtf taxesPostfiling investorsProtectingMinInvesdtf investorsProtectingInvdtf save "DTF calculations.dta", replace foreach v of varlist contracts_filing_days contracts_trial_days contracts_enforcement_days /// contracts_attorney_fee contracts_court_fee contracts_enforcement_fee { recode `v' (-22=.) } gsort economy -dbyear export excel using "Historical data - COMPLETE dataset_Doing Business 2020.xlsx", sheet("FINAL DATASET") sheetmodify firstrow(varlabel) /* END OF DO FILE */