From 81a3ade5282b42abb6cb599752a006d84aad8cb3 Mon Sep 17 00:00:00 2001 From: Katriel Friedman Date: Mon, 5 Jul 2021 19:08:05 +0530 Subject: [PATCH 1/3] fix 'full' and 'iso' options The 'full' and 'iso' options were each listed twice under the syntax command, which caused them to fail (sometimes?). Remove the duplicate listings. --- src/w/wbopendata.ado | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/w/wbopendata.ado b/src/w/wbopendata.ado index 19288d1..d9d52d5 100644 --- a/src/w/wbopendata.ado +++ b/src/w/wbopendata.ado @@ -27,8 +27,6 @@ version 9.0 CHECK /// NOPRESERVE /// PRESERVEOUT /// - FULL /// - ISO /// COUNTRYMETADATA /// ALL /// BREAKNOMETADATA /// From 1295d2801a26f9991fb4e8f8112670a97d4853a0 Mon Sep 17 00:00:00 2001 From: Katriel Friedman Date: Mon, 5 Jul 2021 20:35:57 +0530 Subject: [PATCH 2/3] add a match option example + small clarification fixes #34 --- src/w/wbopendata.sthlp | 10 +++++++++- src/w/wbopendata_examples.ado | 13 +++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/w/wbopendata.sthlp b/src/w/wbopendata.sthlp index 8e33587..48712ef 100644 --- a/src/w/wbopendata.sthlp +++ b/src/w/wbopendata.sthlp @@ -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} @@ -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} diff --git a/src/w/wbopendata_examples.ado b/src/w/wbopendata_examples.ado index 6a03320..d086daf 100644 --- a/src/w/wbopendata_examples.ado +++ b/src/w/wbopendata_examples.ado @@ -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 From 4aea050786353d85d9c36fbf5fd3264a44909430 Mon Sep 17 00:00:00 2001 From: Katriel Friedman Date: Mon, 5 Jul 2021 21:42:37 +0530 Subject: [PATCH 3/3] fix _countrymetadata sub-options --- src/_/_countrymetadata.ado | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/_/_countrymetadata.ado b/src/_/_countrymetadata.ado index 66b4f13..b93fe3e 100644 --- a/src/_/_countrymetadata.ado +++ b/src/_/_countrymetadata.ado @@ -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' "