Skip to content

Commit

Permalink
Merge pull request #44 from ckrf/countrymetadata_fix
Browse files Browse the repository at this point in the history
Country metadata fixes
  • Loading branch information
jpazvd authored Jul 6, 2021
2 parents b048c5d + f221da2 commit 33cb125
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
26 changes: 19 additions & 7 deletions src/_/_countrymetadata.ado
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,39 @@ program define _countrymetadata , rclass
local tmpadminlist " adminregion adminregion_iso2 adminregionname "
local tmpincomelist " incomelevel incomelevel_iso2 incomelevelname "
local tmplendinglist " lendingtype lendingtype_iso2 lendingtypename "
local tmpcapitalist " capital latitude longitude "
local tmpcapitallist " capital latitude longitude "

******************************************************
* asign list variable values if options are selected
if ("`iso'" == "iso") {
local isolist " `tmpisolist' "
foreach word in `tmpisolist' {
local `word' "`word'"
}
}
if ("`regions'" == "regions") {
local regionlist " `tmpregionlist' "
foreach word in `tmpregionlist' {
local `word' "`word'"
}
}
if ("`adminr'" == "adminr") {
local adminlist " `tmpadminlist' "
foreach word in `tmpadminlist' {
local `word' "`word'"
}
}
if ("`income'" == "income") {
local incomelist " `tmpincomelist' "
foreach word in `tmpincomelist' {
local `word' "`word'"
}
}
if ("`lending'" == "lending") {
local lendinglist " `tmplendinglist' "
foreach word in `tmplendinglist' {
local `word' "`word'"
}
}
if ("`capital'" == "capital") {
local capitalist " `tmpcapitallist' "
foreach word in `tmpcapitallist' {
local `word' "`word'"
}
}
if ("`full'" == "full") {
local full " countrycode_iso2 countryname `tmpregionlist' `tmpadminlist' `tmpincomelist' `tmplendinglist' `tmpcapitalist' "
Expand Down
2 changes: 0 additions & 2 deletions src/w/wbopendata.ado
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ version 9.0
CHECK ///
NOPRESERVE ///
PRESERVEOUT ///
FULL ///
ISO ///
COUNTRYMETADATA ///
ALL ///
BREAKNOMETADATA ///
Expand Down
10 changes: 9 additions & 1 deletion src/w/wbopendata.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{synopt :{opt update query}} query the current vintage of indicators and country metadata available.{p_end}
{synopt :{opt update check}} checks the availability of new indicators and country metadata available for download.{p_end}
{synopt :{opt update all}} refreshes the indicators and country metadata information.{p_end}
{synopt :{opt match(varname)}} mergue {help wbopendata##attributes:country attributes} using WDI countrycodes.{p_end}
{synopt :{opt match(varname)}} merge {help wbopendata##attributes:country attributes} into an existing dataset containing WDI (3 digit) countrycodes. Cannot be used with the data download options.{p_end}
{synopt :{opt projection}} World Bank {help wbopendata_sourceid_indicators40##sourceid_40:population estimates and projections} (HPP) .{p_end}
{synopt :{opt metadataoffline}} download all indicator metadata informaiton and generates 71 sthlp files in your local machine.{p_end}
{synoptline}
Expand Down Expand Up @@ -465,6 +465,14 @@ at the World Bank Data website to identify which format is supported.{p_end}

{txt} ({stata "wbopendata_examples example04":click to run})

{cmd}
. sysuse world-d, clear
. wbopendata, match(countrycode)
. keep countrycode countryname adminregion incomelevel area perimeter
. list in 1/5

{txt} ({stata "wbopendata_examples example05":click to run})

{marker disclaimer}{...}
{title:Disclaimer}
{p 40 20 2}(Go up to {it:{help wbopendata##sections:Sections Menu}}){p_end}
Expand Down
13 changes: 13 additions & 0 deletions src/w/wbopendata_examples.ado
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,16 @@ program example04
note("Source: World Development Indicators (latest available year as off `time') using Azevedo, J.P. (2011) wbopendata: Stata" "module to access World Bank databases, Statistical Software Components S457234 Boston College Department of Economics.", size(*.7))

end

* ----------------------------------------------------------------------------
* 5. match option
* ----------------------------------------------------------------------------

capture program drop example05
program define example05
sysuse world-d, clear
wbopendata, match(countrycode)
keep countrycode countryname adminregion incomelevel area perimeter
list in 1/5

end

0 comments on commit 33cb125

Please sign in to comment.