Pragmatic Data Provisioning for the Online Era

A while back the World bank decided to open all its data. A recent release of a stata module which hooks into their online provisioning system called wbopendata tops their data opening efforts and I think the Worldbank deserves praise for their doing so. The module works like some of mine do (usd, stockquote, weeklyclaims) and it is a prime example of modern data provisioning. To install the module you just simply type: ssc install wbopendata in the stata command line (you can also do ssc install usd, stockquote, weeklyclaims of course 🙂 ). The module works in three ways:

  • country – all indicators for all years for a single country.
  • topic – all indicators within a specific topic, for all years and all countries.
  • indicator – all years for all countries for a single indicator.

So running wbopendata, country(DE) will give you over a thousand indicators for Germany from 1960 to 2011. Here is a throw-away script which uses the module and prepares the data for time series analysis:


set more off
wbopendata, country(DE)

local N = _N
*We want to turn indicatorcodes to var names
*dots must go. we turn them into underscores.
forvalues i =1(1)5{
replace indicatorcode = regexr(indicatorcode,”.”,”_”)

forvalues i =1(1)`N'{
local dummy = indicatorcode[`i’]
local dummier = indicatorname[`i’]
gen `dummy’ = .
label var `dummy’  “`dummier'”
forvalues k =1960(1)2011{
local j = `k’-1959
replace `dummy’ = yr`k'[`i’] in  `j’

keep *_*
drop if _n > 2011-1960
gen year = 1959+_n
tset year