*=============================================================================== /* DATE: October 31, 2018 NAME: DOING BUSINESS HISTORICAL SCORES DO FILE. Three datasets are merged to calculate the scores: 1- Historical_DB19_16.10.2018.dta: Containes the Doing Business Historical dataset with individual component indicators since DB2004. 2- Best Regultary Practice and worst performance DB18_10.04.17.xlsx: Excel file with worst and best regulatory 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. The output is saved in an excel file called "Historical data - COMPLETE dataset_Doing Business 2019_31_Oct_2018.xlsx" and the file is saved in the same directory where the input files are stored (Defined by user in STEP 0 below). NOTES: The ease of doing business score captures the gap between an economy’s performance and a measure of 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- 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 based on 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 often refer to as "Frontier". In this file we refer to frontier as "Best Regulatory practice" but for Stata simplicity, we still use the term "frontier" in the code Each methodology expansion was back-calculated for one year to provide comparable data for the previous year. */ *=============================================================================== clear set more off /*============================================================================== STEP 0 To user: Please update the directory (cd "...") and download the main datasets there: Historical data */ cd "C:\Users\AGonzalez7\Documents\Historical Scores" use "Historical_DB19_20181031.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 regulatory performance DB18 20181031.xlsx (provided) dataset is used in this step.*/ *=============================================================================== preserve clear import excel "best and worst regulatory performance DB18 20181031.xlsx", sheet("DB18_B&W table in stata format") cellrange(A1:BP4) firstrow case(preserve) 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 "Best Regulatory Performance" 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_DB18.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_DB18.dta", force order dtfparameter, after(dbyear) sort dtfparameter cod dbyear economy drop investorsconflicts investorsgovernance /* 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 startbusprocedures-taxesPostfiling { 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 registerLegalindex registerLegalindexGener /// creditrights creditinformation6pnt5pr gettingcredit creditrights_new creditinformation8pnt5pr gettingcreditnew /// 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 contractsLegalindexGender /// contractsproceduresBunus contractsLegalindex /// 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'~=. } *browse taxespayments taxestime taxestotal taxesTimeCompleteCITaudit taxesTimeComplyCITaudit taxesTimeComplyVATrefund taxesTimeObtainVATrefund taxesTTROther taxesTTRlabor taxesTTRprofit taxesPostfiling nptaxespayments nptaxestime nptaxestotal nptaxesTimeCompleteCITaudit nptaxesTimeComplyCITaudit nptaxesTimeComplyVATrefund nptaxesTimeObtainVATrefund nptaxesTTROther nptaxesTTRlabor nptaxesTTRprofit nptaxesPostfiling taxespaymentsworst taxespaymentsbest taxespaymentsdtf taxestimeworst taxestimebest taxestimedtf taxestotalworst taxestotalbest taxestotaldtf if economy=="Philippines" & dbyear==2017 *stop /* 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 REFUND'*/ } 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 registerLegalindex registerLegalindexGener creditrights creditinformation6pnt5pr gettingcredit creditrights_new creditinformation8pnt5pr gettingcreditnew 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 contractsLegalindex 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 startbusprocedures-taxesPostfiling { 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) 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 DB2016, takes into account the quality of land administration index*/ gen DTFregister =(registerproceduresdtf+registertimedtf+registercostdtf+registerLegalindexdtf)/4 if dbyear<=2016 /* Methodology for DB2017 and on, with gender legal differences*/ 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 =(investorsdisclosuredtf+investorsliabilitydtf+investorssuitsOlddtf)/3 /* Methodology for DB2015 and on, takes into account shareholders’ rights in corporate governance beyond related-party transactions*/ gen DTFinvestors =(investorsdisclosuredtf+investorsliabilitydtf+investorssuitsdtf+investorsrightsdtf+investorsownershipdtf+investorstransparencydtf)/6 *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 DB2016, takes into account the quality of judicial processes index*/ gen DTFcontracts =(contractsLegalindexdtf+contractstimedtf+contractscostdtf)/3 if dbyear<=2016 /* Methodology for DB2017 and on, extension of DB16 methodology taking into account gender legal differences*/ gen DTFcontracts_gender =(contractsLegalindexGenderdtf+contractstimedtf+contractscostdtf)/3 *Resolving Insolvency* /* DB2004-DB2014 methodology*/ gen DTFclosing_old =(closingrecoverydtf) if dbyear<=2014 /* Methodology for DB2015 and on, takes into account the strength of insolvency framework index*/ 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 adde 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) gen str cod = "0" gen str economy = "0" gen str region = "0" gen str incomegroup = "0" 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 save "Merged cities.dta", replace /*append to main dataset*/ restore append using "Merged cities.dta" 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 global" historical data are included starting in DB2010 when the last topic, getting electricity, was added.*/ *************************************************************************************************** foreach v of varlist DTF* { recast double `v' gen `v'1=round(`v',.00001) /* Global score is calculated based off of the individual indicators' scores rounded to 5 decimal places. */ } /* Computation of the global score with electricity for DB10 to DB2014. */ gen DTFdb1014_global=(DTFstartbus_gender1 +DTFpermit_old1 +DTFelectricity_old1 +DTFregister_old1 +DTFcredit_old1 +DTFinvestors_old1 +DTFtaxes_old1 +DTFtradedef_old1 +DTFcontracts_old1 +DTFclosing_old1)/10 /* if dbyear<2015 */ /* Computation of the global score for DB2014 and DB2015, unsing DB2015 methodology. Resolving Insolvency introduced new measures of quality and 2 topics (Getting Credit, Protecting Minority Investors) broadened the existing measures*/ gen DTFdb1415_global=(DTFstartbus_gender1 +DTFpermit_old1 +DTFelectricity_old1 +DTFregister_old1 +DTFcredit1 +DTFinvestors1 +DTFtaxes_old1 +DTFtradedef_old1 +DTFcontracts_old1 +DTFclosing1)/10 /* if dbyear==2014 | dbyear==2015 */ /* Computation of the global score using DB2016 methodology. 4 topics (Dealing with Construction Permits, Getting Electricity, Registering Property and Enforcing Contracts) also introduced new measures of quality. Additionally, Trading across Borders overhauled its methodology to increase the relevance of indicators. */ gen DTFdb15_global=(DTFstartbus_gender1 +DTFcontracts1 +DTFregister1 +DTFpermit1 +DTFelectricity1 +DTFcredit1 +DTFinvestors1 +DTFtaxes_old1 +DTFtrade1 +DTFclosing1)/10 if dbyear==2015 | dbyear==2016 /* Computation of the global score for DB2017-2019 methodology - current methodogy. DB2017: Incorporated the assessment of gender legal differences, expanded the Paying taxes indicator */ gen DTFdb1619_global=(DTFstartbus_gender1 +DTFcontracts_gender1 +DTFregister_gender1 +DTFpermit1 +DTFelectricity1 +DTFcredit1 +DTFinvestors1 +DTFtaxes1 +DTFtrade1 +DTFclosing1)/10 /* if dbyear>2016 */ drop DTFstartbus_gender1 DTFpermit_old1 DTFpermit1 DTFelectricity_old1 DTFelectricity1 DTFregister_old1 DTFregister1 DTFregister_gender1 DTFcredit_old1 DTFcredit1 DTFinvestors_old1 DTFinvestors1 DTFtaxes_old1 DTFtaxes1 DTFtradedef_old1 DTFtrade1 DTFcontracts_old1 DTFcontracts1 DTFcontracts_gender1 DTFclosing_old1 DTFclosing1 sort cod dbyear economy *************************************************************************************************** //////// STEP 5 * GLOBAL RANK FOR DB2019* //////// *************************************************************************************************** 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)*/ foreach v of varlist DTF* { /* ranking is calculated based off of the score rounded to 2 decimal places. */ recast double `v' format `v' %10.0g replace `v'=round(`v',.01) } 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" bysort dbyear: egen GlobalRankDB1718= rank(DTFdb1619_global) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankStarting1718= rank(DTFstartbus_gender) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankPermit1718= rank(DTFpermit) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankElectricity1718= rank(DTFelectricity) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankRegister1718= rank(DTFregister_gender) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankCredit1718= rank(DTFcredit) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankInvestors1718= rank(DTFinvestors) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankTaxes1718= rank(DTFtaxes) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankTrade1718= rank(DTFtrade) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankContracts1718= rank(DTFcontracts_gender) if sample190==1 & dbyear>2018 , field bysort dbyear: egen RankClosing1718= rank(DTFclosing) if sample190==1 & dbyear>2018 , field ************************************************************************************************** ////////* Formatting/application of decimal rules*////// ************************************************************************************************** g double virtual11=1 if cod=="BANG" | cod=="BRAZ" | cod=="CHIN" | cod=="INDI" | cod=="INDO" | cod=="JAP" | cod=="MEXI" | cod=="NIGE" | cod=="PAKI" | cod=="RUSS" | cod=="US" foreach v of varlist startbusprocedures startbusproceduresW permitprocedures electricityprocedures electricitytime /// electricitySAIDISAIFIscore registerprocedures investorssuitsOld investorsdisclosure investorsliability investorssuits investorsrights /// investorsownership investorstransparency investorsProtectingInvestors investorsProtectingMinInves /// taxespayments tradingexportdocs tradingimportdocs tradingexportcost_def tradingimportcost_def tradingexporttime tradingimporttime /// tradeXtimedocs tradeMtimedocs tradeXtimeborder tradeMtimeborder tradeXcostdocs tradeMcostdocs tradeXcostborder tradeMcostborder /// contractsproceduresBunus contractstime { replace `v'=round(real(string(`v'*100, "%10.0g")),10)/100 if virtual11==1 format `v' %10.0g replace `v'=round(`v',.1) if virtual11==1 replace `v'=round(`v', 1) if virtual11!=1 } foreach v of varlist creditrights creditrights_new creditinformation6pnt5pr creditinformation8pnt5pr { format `v' %10.0g replace `v'=round(`v',1) } foreach v of varlist startbustime startbustimeW startbuscost startbuscostW startbuscapital permittime permitcostWhV permitsLegalindex permits_SI_Buildregulation permits_SI_Beforeconstr permits_SI_Duringconst /// permits_SI_Afterconst permits_SI_Liability permits_SI_Certifications electricitycost electricitySaidiSaifiPoints electricitySaidiIndex electricitySaifiIndex electricityRegulatormoniscore /// electricityCompensationscore electricityTransparencyscore electricityMinimumOutage electricityPriceperkWhUSD registertime registercost registerLegalindex /// registerReliabilityInfrast registerTransparency registerCoverage registerLegalBackground registerWEBEqualAccess registerLegalindexGener creditinformationCoverPrivate creditinformationCoverPublic /// investorsConflictInterest investorsShareholderGovernance taxestime taxestotal taxesTTRprofit taxesTTRlabor taxesTTROther taxesTimeComplyVATrefund taxesTimeObtainVATrefund taxesTimeComplyCITaudit taxesTimeCompleteCITaudit /// contractscost contractsLegalindex contractsLegalindexGender contracts_SI_CourtStructure contracts_SI_CourtStructureGen contracts_SI_CaseManagement contracts_SI_CourtAutomation contracts_SI_ADR /// contracts_filing_days contracts_trial_days contracts_enforcement_days contracts_attorney_fee contracts_court_fee contracts_enforcement_fee /// closingtime_web closingcostpercentage closingrecovery closinglegal closing_SI_Commencement closing_SI_ManagementAssets closing_SI_Reorganization closing_SI_CreditorParticipate { replace `v'=round(real(string(`v'*100, "%10.0g")),10)/100 if virtual11==1 format `v' %10.0g replace `v'=round(`v',.1) } foreach v of varlist *dtf { replace `v'=round(real(string(`v'*1000, "%10.0g")),10)/1000 format `v' %10.0g replace `v'=round(`v',.001) } ************************************************************************************************** ////////* 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 "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-19 methodology)" label var permits_SI_Buildregulation "Quality of building regulations index (0-2) (DB16-19 methodology)" label var permits_SI_Beforeconstr "Quality control before construction index (0-1) (DB16-19 methodology)" label var permits_SI_Duringconst "Quality control during construction index (0-3) (DB16-19 methodology)" label var permits_SI_Afterconst "Quality control after construction index (0-3) (DB16-19 methodology)" label var permits_SI_Liability "Liability and insurance regimes index (0-2) (DB16-19 methodology)" label var permits_SI_Certifications "Professional certifications index (0-4) (DB16-19 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-19 methodology)" label var electricityPriceperkWhUSD "Price of electricity (US cents per kWh) (DB16-19 methodology)" label var electricitySaidiSaifiPoints "Total duration and frequency of outages per customer a year (0-3) (DB16-19 methodology)" label var electricitySaidiIndex "System average interruption duration index (SAIDI) (DB16-19 methodology)" label var electricitySaifiIndex "System average interruption frequency index (SAIFI) (DB16-19 methodology)" label var electricityMinimumOutage "Minimum outage time (in minutes) (DB16-19 methodology)" label var electricityOutagemoniscore "Mechanisms for monitoring outages (0-1) (DB16-19 methodology)" label var electricityOutagerestoscore "Mechanisms for restoring service (0-1) (DB16-19 methodology)" label var electricityRegulatormoniscore "Regulatory monitoring (0-1) (DB16-19 methodology)" label var electricityCompensationscore "Financial deterrents aimed at limiting outages (0-1) (DB16-19 methodology)" label var electricityTransparencyscore "Communication of tariffs and tariff changes (0-1) (DB16-19 methodology)" label var registerprocedures "Procedures (number)" label var registertime "Time (days)" label var registercost "Cost (% of property value)" label var registerLegalindex "Quality of land administration index (0-30) (DB16 methodology)" label var registerLegalindexGener "Quality of land administration index (0-30) (DB17-19 methodology)" label var registerReliabilityInfrast "Reliability of infrastructure index (0-8) (DB16-19 methodology)" label var registerTransparency "Transparency of information index (0-6) (DB16-19 methodology)" label var registerCoverage "Geographic coverage index (0-8) (DB16-19 methodology)" label var registerLegalBackground "Land dispute resolution index (0-8) (DB16-19 methodology)" label var registerWEBEqualAccess "Equal access to property rights index (-2-0) (DB17-19 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-19 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-19 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-19 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-19 methodology) " label var investorsrights "Extent of shareholder rights index (0-10) (DB15-19 methodology) " label var investorsownership "Extent of ownership and control index (0-10) (DB15-19 methodology) " label var investorstransparency "Extent of corporate transparency index (0-10) (DB15-19 methodology) " label var investorsConflictInterest "Extent of conflict of interest regulation index (0-10) (DB15-19 methodology) " label var investorsShareholderGovernance "Extent of shareholder governance index (0-10) (DB15-19 methodology) " label var investorsProtectingInvestors "Strength of investor protection index (0-10) (DB06-14 methodology)" label var investorsProtectingMinInves "Strength of minority investor protection index (0-10) (DB15-19 methodology) " label var tradeXtimedocs "Time to export: Documentary compliance (hours) (DB16-19 methodology)" label var tradeMtimedocs "Time to import: Documentary compliance (hours) (DB16-19 methodology)" label var tradeXtimeborder "Time to export: Border compliance (hours) (DB16-19 methodology)" label var tradeMtimeborder "Time to import: Border compliance (hours) (DB16-19 methodology)" label var tradeXcostdocs "Cost to export: Documentary compliance (USD) (DB16-19 methodology)" label var tradeMcostdocs "Cost to import: Documentary compliance (USD) (DB16-19 methodology)" label var tradeXcostborder "Cost to export: Border compliance (USD) (DB16-19 methodology)" label var tradeMcostborder "Cost to import: Border compliance (USD) (DB16-19 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)" label var contractstime "Time (days)" label var contractscost "Cost (% of claim)" label var contractsLegalindex "Quality of the judicial processes index (0-18) (DB16 methodology)" label var contractsLegalindexGender "Quality of the judicial administration index (0-18) (DB17-19 methodology)" label var contracts_SI_CourtStructure "Court structure and proceedings (0-5) (DB16 methodology)" label var contracts_SI_CourtStructureGen "Court structure and proceedings (0-5) (DB17-19 methodology)" label var contracts_SI_CaseManagement "Case management (0-6) (DB16-19 methodology)" label var contracts_SI_CourtAutomation "Court automation (0-4) (DB16-19 methodology)" label var contracts_SI_ADR "Alternative dispute resolution (0-3) (DB16-19 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) (DB15-19 methodology)" 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-19 methodology)" label var closing_SI_ManagementAssets "Management of debtor's assets index (0-6) (DB15-19 methodology)" label var closing_SI_Reorganization "Reorganization proceedings index (0-3) (DB15-19 methodology)" label var closing_SI_CreditorParticipate "Creditor participation index (0-4) (DB15-19 methodology)" label var taxespayments "Payments (number per year)" label var taxestime "Time (hours per year)" label var taxestotal "Total tax 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-19 methodology)" label var taxesTimeObtainVATrefund "Time to obtain VAT refund (weeks) (DB17-19 methodology)" label var taxesTimeComplyCITaudit "Time to comply with a corporate income tax correction (hours) (DB17-19 methodology)" label var taxesTimeCompleteCITaudit "Time to complete a corporate income tax correction (weeks) (DB17-19 methodology)" ///*** LABELING SCORE VARIABLES FOR DISPLAY ON THE WEB ***/// label var GlobalRankDB1718 "Ease of doing business rank global (DB19)" label var DTFdb1619_global "Ease of doing business score global (DB17-19 methodology)" label var DTFdb15_global "Ease of doing business score global (DB16 methodology)" label var DTFdb1415_global "Ease of doing business score global (DB15 methodology)" label var DTFdb1014_global "Ease of doing business score global (DB10-14 methodology)" label var RankStarting1718 "Rank-Starting a business (DB19)" 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 (DB19)" label var DTFpermit "Score-Dealing with construction permits (DB16-19 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-19 methodology)" label var RankElectricity1718 "Rank-Getting electricity (DB19)" label var DTFelectricity "Score-Getting electricity (DB16-19 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-19 methodology)" label var RankRegister1718 "Rank-Registering property (DB19)" label var DTFregister_gender "Score-Registering property (DB17-19 methodology)" label var DTFregister "Score-Registering property (DB16 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 registerLegalindexdtf "Score-Quality of land administration index (0-30) (DB16 methodology)" label var registerLegalindexGenerdtf "Score-Quality of land administration index with Gender(0-30)(DB17-19 methodology)" label var DTFcredit "Score-Getting credit (DB15-19 methodology)" label var DTFcredit_old "Score-Getting credit (DB05-14 methodology)" label var RankCredit1718 "Rank-Getting credit (DB19)" 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-19 methodology) " label var creditinformation8pnt5prdtf "Score-Depth of credit information index (0-8) (DB15-19 methodology) " label var RankInvestors1718 "Rank-Protecting minority investors (DB19) " label var DTFinvestors "Score-Protecting minority investors (DB15-19 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-19 methodology)" label var investorsrightsdtf "Score-Extent of shareholder rights index (0-10) (DB15-19 methodology)" label var investorsownershipdtf "Score-Extent of ownership and control index (0-10) (DB15-19 methodology)" label var investorstransparencydtf "Score-Extent of corporate transparency index (0-10) (DB15-19 methodology)" label var RankTaxes1718 "Rank-Paying taxes (DB19)" label var DTFtaxes "Score-Paying taxes (DB17-19 methodology)" label var DTFtaxes_old "Score-Paying taxes (DB06-16 methodology)" label var taxesPostfilingdtf "Score-Postfiling index (0-100) (DB17-19 methodology)" label var taxespaymentsdtf "Score-Payments (number per year)" label var taxestimedtf "Score-Time (hours per year)" label var taxestotaldtf "Score-Total tax rate (% of profit)" label var taxesTimeComplyVATrefunddtf "Score-Time to comply with VAT refund (hours) (DB17-19 methodology)" label var taxesTimeObtainVATrefunddtf "Score-Time to obtain VAT refund (weeks) (DB17-19 methodology)" label var taxesTimeComplyCITauditdtf "Score-Time to comply with a corporate income tax correction (hours) (DB17-19 methodology)" label var taxesTimeCompleteCITauditdtf "Score-Time to complete a corporate income tax correction (weeks) (DB17-19 methodology)" label var RankTrade1718 "Rank-Trading across borders (DB19)" label var DTFtrade "Score-Trading across borders(DB16-19 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) (DB06-15 methodology)" label var tradingimportcost_defdtf "Score-Cost to import (US$ per container) (DB06-15 methodology)" label var tradeXtimeborderdtf "Score-Time to export: Border compliance (hours) (DB16-19 methodology)" label var tradeMtimeborderdtf "Score-Time to import: Border compliance (hours) (DB16-19 methodology)" label var tradeXtimedocsdtf "Score-Time to export: Documentary compliance (hours) (DB16-19 methodology)" label var tradeMtimedocsdtf "Score-Time to import: Documentary compliance (hours) (DB16-19 methodology)" label var tradeXcostborderdtf "Score-Cost to export: Border compliance (USD) (DB16-19 methodology)" label var tradeMcostborderdtf "Score-Cost to import: Border compliance (USD) (DB16-19 methodology)" label var tradeXcostdocsdtf "Score-Cost to export: Documentary compliance (USD) (DB16-19 methodology)" label var tradeMcostdocsdtf "Score-Cost to import: Documentary compliance (USD) (DB16-19 methodology)" label var RankContracts1718 "Rank-Enforcing contract (DB19)" label var DTFcontracts_gender "Score-Enforcing contract (DB17-19 methodology)" label var DTFcontracts "Score-Enforcing contracts (DB16 methodology)" label var DTFcontracts_old "Score-Enforcing contracts (DB04-15 methodology)" label var contractsproceduresBunusdtf "Score-Procedures (number)" label var contractstimedtf "Score-Time (days)" label var contractscostdtf "Score-Cost (% of claim)" label var contractsLegalindexdtf "Score-Quality of the judicial processes index (0-19) (DB16 methodology)" label var contractsLegalindexGenderdtf "Score-Quality of the judicial processes index (0-19) (DB17-19 methodology)" label var RankClosing1718 "Rank-Resolving insolvency (DB19)" label var DTFclosing "Score-Resolving insolvency (DB15-19 methodology)" label var DTFclosing_old "Score-Resolving insolvency (DB04-14 methodology)" label var closingrecoverydtf "Score-Recovery rate (cents on the dollar)" label var closinglegaldtf "Score-Strength of insolvency framework index (0-16) (DB15-19 methodology)" ///*** ORDER OF DATA POINTS FOR DISPLAY ON THE WEB ***/// order cod economy region incomegroup dbyear GlobalRankDB1718 DTFdb1619_global DTFdb15_global DTFdb1415_global DTFdb1014_global, first /* 1. STARTING A BUSINESS */ order RankStarting1718 DTFstartbus_gender, after(DTFdb1014_global) order startbusprocedures startbustime startbuscost startbusproceduresW startbustimeW startbuscostW startbuscapital /// startbusproceduresdtf startbustimedtf startbuscostdtf startbusproceduresWdtf startbustimeWdtf startbuscostWdtf startbuscapitaldtf, after(DTFstartbus_gender) /* 2. DEALING WITH CONSTRUCTION PERMITS */ order RankPermit1718 DTFpermit DTFpermit_old, after(startbuscapitaldtf) order permitprocedures permittime permitcostWhV permitsLegalindex /// permits_SI_Buildregulation permits_SI_Beforeconstr permits_SI_Duringconst permits_SI_Afterconst permits_SI_Liability permits_SI_Certifications /// permitproceduresdtf permittimedtf permitcostWhVdtf permitsLegalindexdtf, after(DTFpermit_old) /* 3. GETTING ELECTRICITY */ order RankElectricity1718 DTFelectricity DTFelectricity_old, after(permitsLegalindexdtf) order electricityprocedures electricitytime electricitycost electricitySAIDISAIFIscore /// electricitySaidiSaifiPoints electricitySaidiIndex electricitySaifiIndex electricityMinimumOutage electricityOutagemoniscore /// electricityOutagerestoscore electricityRegulatormoniscore electricityCompensationscore electricityTransparencyscore electricityPriceperkWhUSD /// electricityproceduresdtf electricitytimedtf electricitycostdtf electricitySAIDISAIFIscoredtf, after(DTFelectricity_old) /* 4. REGISTERING PROPERTY */ order RankRegister1718 DTFregister_gender DTFregister DTFregister_old, after(electricitySAIDISAIFIscoredtf) order registerprocedures registertime registercost registerLegalindex registerLegalindexGener /// registerReliabilityInfrast registerTransparency registerCoverage registerLegalBackground registerWEBEqualAccess /// registerproceduresdtf registertimedtf registercostdtf registerLegalindexdtf registerLegalindexGenerdtf, after(DTFregister_old) /* 5. GETTING CREDIT */ order RankCredit1718 DTFcredit DTFcredit_old, after(registerLegalindexGenerdtf) order creditrights creditrights_new creditinformation6pnt5pr creditinformation8pnt5pr creditinformationCoverPublic creditinformationCoverPrivate /// gettingcredit gettingcreditnew creditrightsdtf creditinformation6pnt5prdtf creditrights_newdtf creditinformation8pnt5prdtf, after(DTFcredit_old) /* 6. PROTECTING MINORITY INVESTORS */ order RankInvestors1718 DTFinvestors DTFinvestors_old, after(creditinformation8pnt5prdtf) order investorsdisclosure investorsliability investorssuitsOld investorssuits investorsrights investorsownership investorstransparency /// investorsConflictInterest investorsShareholderGovernance investorsProtectingInvestors investorsProtectingMinInves /// investorsdisclosuredtf investorsliabilitydtf investorssuitsOlddtf investorssuitsdtf investorsrightsdtf investorsownershipdtf investorstransparencydtf, after(DTFinvestors_old) /* 7. PAYING TAXES */ order RankTaxes1718 DTFtaxes DTFtaxes_old, after(investorstransparencydtf) order taxespayments taxestime taxestotal taxesTTRprofit taxesTTRlabor taxesTTROther /// taxesTimeComplyVATrefund taxesTimeObtainVATrefund taxesTimeComplyCITaudit taxesTimeCompleteCITaudit /// taxesPostfilingdtf taxespaymentsdtf taxestimedtf taxestotaldtf taxesTimeComplyVATrefunddtf taxesTimeObtainVATrefunddtf taxesTimeComplyCITauditdtf taxesTimeCompleteCITauditdtf, after(DTFtaxes_old) /* 8. TRADING ACROSS BORDERS */ /* OLD */ order RankTrade1718 DTFtrade DTFtradedef_old, after(taxesTimeCompleteCITauditdtf) order tradingexportdocs tradingimportdocs tradingexportcost_def tradingimportcost_def tradingexporttime tradingimporttime, after(DTFtradedef_old) /* NEW */ order tradeXtimedocs tradeMtimedocs tradeXtimeborder tradeMtimeborder tradeXcostdocs tradeMcostdocs tradeXcostborder tradeMcostborder, after(tradingimporttime) /* OLD */ order tradingexportdocsdtf tradingimportdocsdtf tradingexportcost_defdtf tradingimportcost_defdtf tradingexporttimedtf tradingimporttimedtf, after(tradeMcostborder) /* NEW */ order tradeXtimedocsdtf tradeMtimedocsdtf tradeXtimeborderdtf tradeMtimeborderdtf tradeXcostdocsdtf tradeMcostdocsdtf tradeXcostborderdtf tradeMcostborderdtf, after(tradingimporttimedtf) /* 9. ENFORCING CONTRACTS */ order RankContracts1718 DTFcontracts_gender DTFcontracts DTFcontracts_old, after(tradeMcostborderdtf) order contractsproceduresBunus contractstime contracts_filing_days contracts_trial_days contracts_enforcement_days /// contractscost contracts_attorney_fee contracts_court_fee contracts_enforcement_fee contractsLegalindex contractsLegalindexGender /// contracts_SI_CourtStructure contracts_SI_CourtStructureGen contracts_SI_CaseManagement contracts_SI_CourtAutomation contracts_SI_ADR /// contractsproceduresBunusdtf contractstimedtf contractscostdtf contractsLegalindexdtf contractsLegalindexGenderdtf, after(DTFcontracts_old) /* 10. RESOLVING INSOLVENCY */ order RankClosing1718 DTFclosing DTFclosing_old, after(contractsLegalindexGenderdtf) order closingOutcome closingtime_web closingcostpercentage closingrecovery closinglegal /// closing_SI_Commencement closing_SI_ManagementAssets closing_SI_Reorganization closing_SI_CreditorParticipate /// closingrecoverydtf closinglegaldtf, after(DTFclosing_old) ///*** 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 } recode registerWEBEqualAccess (-9999=-1) if DTFregister_gender!=0 drop creditinformation6pnt economyVAT noCIT noVAT tradeprocedures tradingexportcost tradingimportcost closingtime gettingcreditdtf sample190 gettingcreditnewdtf virtual11 taxesPostfiling 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=.) } sort cod economy dbyear export excel using "Historical data - COMPLETE dataset_Doing Business 2019_31_Oct_2018.xlsx", sheet("FINAL DATASET") sheetmodify firstrow(varlabel) /* END OF DO FILE */