Skip to content

Commit

Permalink
Merge branch 'SJ_comments'
Browse files Browse the repository at this point in the history
  • Loading branch information
randrescastaneda committed Sep 3, 2020
2 parents 84802f4 + eaa0709 commit 683a9f5
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 233 deletions.
71 changes: 64 additions & 7 deletions povcalnet.ado
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ else pause off

qui {


//========================================================
// Conditions
//========================================================
if ("`aggregate'" != "" & "`fillgaps'" != "") {
noi disp in red "options {it:aggregate} and {it:fillgaps} are mutually exclusive." _n /*
*/ "Please select only one."
error
}


// ------------------------------------------------------------------------
// New session procedure
// ------------------------------------------------------------------------
Expand Down Expand Up @@ -178,7 +189,7 @@ qui {
noi disp as result "SSC version of {cmd:povcalnet} is up to date."
local bye ""
}
} // Finish checking povclanet update
} // Finish checking povcalnet update
else {
noi disp as result "Source of {cmd:povcalnet} package not found." _n ///
"You won't be able to benefit from latest updates."
Expand Down Expand Up @@ -267,7 +278,7 @@ qui {
error
}
local fq = "`base'?${pcn_query}"
noi disp in y "quering" in w _n "`fq'"
noi disp in y "querying" in w _n "`fq'"
noi view browse "`fq'"
exit
}
Expand All @@ -278,7 +289,7 @@ qui {
local aggregate ""
local subcommand "wb"
local wb_change 1
noi disp as err "Warning: " as text " {cmd:povclanet, country(all) aggregate} " /*
noi disp as err "Warning: " as text " {cmd:povcalnet, country(all) aggregate} " /*
*/ "is equivalent to {cmd:povcalnet wb}. " _n /*
*/ " if you want to aggregate all countries by survey years, " /*
*/ "you need to parse the list of countries in {it:country()} option. See " /*
Expand Down Expand Up @@ -386,7 +397,7 @@ qui {

*---------- Country and region
if ("`country'" != "") & ("`region'" != "") {
noi disp in r "options {it:country()} and {it:region()} are mutally exclusive"
noi disp in r "options {it:country()} and {it:region()} are mutually exclusive"
error
}

Expand Down Expand Up @@ -536,7 +547,7 @@ qui {
local rtype 2
}

pause after downdload
pause after download

*---------- Clean data
povcalnet_clean `rtype', year("`year'") `iso' /*
Expand Down Expand Up @@ -600,6 +611,52 @@ qui {
}
}


//========================================================
// Create notes
//========================================================

local pllabel ""
foreach p of local povline {
local pllabel "`pllabel' \$`p'"
}
local pllabel = trim("`pllabel'")
local pllabel: subinstr local pllabel " " ", ", all



if ("`wb'" == "") {
if ("`aggregate'" == "" & "`fillgaps'" == "") {
local lvlabel "country level"
}
else if ("`aggregate'" != "" & "`fillgaps'" == "") {
local lvlabel "aggregated level"
}
else if ("`aggregate'" == "" & "`fillgaps'" != "") {
local lvlabel "Country level (lined up)"
}
else {
local lvlabel ""
}
}
else {
local lvlabel "regional and global level"
}


local datalabel "WB poverty at `lvlabel' using `pllabel'"
local datalabel = substr("`datalabel'", 1, 80)

label data "`datalabel' (`c(current_date)')"

* citations
local cite `"Please cite as: Castaneda Aguilar, R. A., C. Lakner, E. B. Prydz, J. S. Lopez, R. Wu and Q. Zhao (2019) "povcalnet: Stata module to access World Bank’s Global Poverty and Inequality data," Statistical Software Components 2019, Boston College Department of Economics."'
notes: `cite'

noi disp in y _n `"`cite'"'

return local cite `"`cite'"'

} // end of qui
end

Expand Down Expand Up @@ -633,10 +690,10 @@ qui {
if (`"`pklines'"' == `""') local src = "NotInstalled"
else {

// the latest source and substract which refers to the source
// the latest source and subtract which refers to the source
local sourceline = max(0, `pklines') - 1

// get the Soruce without the initial S
// get the source without the initial S
if regexm(v1[`sourceline'], "S (.*)") local src = regexs(1)
}

Expand Down
15 changes: 7 additions & 8 deletions povcalnet.pkg
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
v 3
d 'POVCALNET': povcalnet
d 'POVCALNET': PovcalNet
d
d Distribution-Date: 14aug2019
d License: MIT
d Distribution-Date: 03sep2020
d License: None
d
F povcalnet.ado
F povcalnet.sthlp
F povcalnet_countries.sthlp
F povcalnet_aggquery.ado
F povcalnet_cl.ado
F povcalnet.ado
F povcalnet.sthlp
F povcalnet_cl.ado
F povcalnet_clean.ado
F povcalnet_countries.sthlp
F povcalnet_examples.ado
F povcalnet_info.ado
F povcalnet_query.ado
46 changes: 27 additions & 19 deletions povcalnet.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{viewerjumpto "Disclaimer" "povcalnet##disclaimer"}{...}
{viewerjumpto "How to cite" "povcalnet##howtocite"}{...}
{viewerjumpto "References" "povcalnet##references"}{...}
{viewerjumpto "Acknowledgements" "povcalnet##acknowled"}{...}
{viewerjumpto "Acknowledgments" "povcalnet##acknowled"}{...}
{viewerjumpto "Authors" "povcalnet##authors"}{...}
{viewerjumpto "Regions" "povcalnet_countries##regions"}{...}
{viewerjumpto "Countries" "povcalnet_countries##countries"}{...}
Expand All @@ -39,7 +39,7 @@ Cannot be used with option {it:country()}{p_end}
{synopt :{opt year:}(numlist|string)}list of years (accepts up to 10), or {it:all}, or {it:last}. Default "all".{p_end}
{synopt :{opt pov:line:}(#)}list of poverty lines (in 2011 PPP-adjusted USD) to calculate
poverty measures (accepts up to 5). Default is 1.9.{p_end}
{synopt :{opt pops:hare:}(#)}list of headcounts to calculate poverty lines (in 2011 PPP-adjusted USD) and poverty measures. No default. Do not combine with {opt pov:line:}{p_end}
{synopt :{opt pops:hare:}(#)}list of population shares to calculate poverty lines (in 2011 PPP-adjusted USD) and poverty measures. No default. Do not combine with {opt pov:line:}{p_end}


{synoptset 27 tabbed}{...}
Expand All @@ -53,7 +53,7 @@ groups of countries instead of country-level estimated.{p_end}
{synopt :{opt info:rmation}} presents a clickable version of the available surveys, countries and regions.{p_end}
{synopt :{opt ppp}{cmd:(#)}} allows the selection of PPP. {p_end}
{synopt :{opt querytimes(integer)}} Number of times the API is hit before defaulting to failure.
Default is 5. {it:Advance option. Just use it if internet connection is poor}{p_end}
Default is 5. {it:Advance option. Just use it if Internet connection is poor}{p_end}

{synoptset 27 tabbed}{...}
{synopthdr:subcommands}
Expand All @@ -63,13 +63,19 @@ countries and regions. Same as option {it:information}{p_end}
{synopt :{opt cl}} {it:country-level} query that changes the default combinatorial
arrangement of parameters for a one-on-one correspondence.
See{help povcalnet##typesq: below} for a detailed explanation.{p_end}
{synopt :{opt wb}}downloads World Bank's regional and global aggegation{p_end}
{synopt :{opt wb}}downloads World Bank's regional and global aggregation{p_end}
{synopt :{opt test}}executes the last query in browser regardless of failure by
{cmd:povcalnet}.{p_end}

{synoptset 27 tabbed}{...}
{synopthdr:Internal options}
{synoptline}
{synopt :{opt server(string)}}This option is only available for developers of the
{cmd:povcalnet} package.{p_end}
{synoptline}

{pstd}
{bf:Note}: {cmd:povcalnet} requires internet connection.
{bf:Note}: {cmd:povcalnet} requires Internet connection.

{marker sections}{...}
{title:Sections}
Expand All @@ -85,7 +91,7 @@ Sections are presented under the following headings:
{it:{help povcalnet##Examples:Examples}}
{it:{help povcalnet##disclaimer:Disclaimer}}
{it:{help povcalnet##references:References}}
{it:{help povcalnet##acknowled:Acknowledgements}}
{it:{help povcalnet##acknowled:Acknowledgments}}
{it:{help povcalnet##authors:Authors}}
{it:{help povcalnet##contact:Contact}}
{it:{help povcalnet##howtocite:How to cite}}
Expand All @@ -110,7 +116,7 @@ PovcalNet is managed jointly by the Data and Research Group in the World Bank's

{pstd}
In addition to the mean and median, {cmd:povcalnet} reports the following measures
for poverty (at achosen poverty line) and inequality:
for poverty (at chosen poverty line) and inequality:

{hline 43}
Poverty measures{col 40}Inequality measures
Expand Down Expand Up @@ -207,7 +213,7 @@ Poverty lines are expressed in 2011 PPP-adjusted USD per capita per day.
{phang}
{opt povline(#)} The desired population share (headcount) for which the poverty lines as poverty measures will be calculated.
This has not default, and should not be combined with {opt povline}.
The resultng poverty lines are expressed in 2011 PPP-adjusted USD per capita per day.
The resulting poverty lines are expressed in 2011 PPP-adjusted USD per capita per day.



Expand Down Expand Up @@ -255,7 +261,7 @@ works if one, and only one, country is selected.
{phang}
{opt coverage(string)} Selects coverage level of estimates. By default, all coverage
levels are loaded, but the user may select "national", "urban", or "rural".
Only one level of covarege can be selected per query.
Only one level of coverage can be selected per query.

{marker optinfo}{...}
{phang}
Expand Down Expand Up @@ -329,7 +335,7 @@ poverty lines included in {it:povlines()}:
{synopt:{cmd:r(handler)}}Action handler{p_end}
{synopt:{cmd:r(base)}}concatenation of server, site_name, and handler{p_end}

{p2col 5 20 24 2: addtional info}{p_end}
{p2col 5 20 24 2: additional info}{p_end}
{synopt:{cmd:r(queryfull_{it:#})}}Complete query{p_end}
{synopt:{cmd:r(npl)}}Number of poverty lines{p_end}
{synopt:{cmd:pcn_query}}Global macro with query information in case {cmd:povcalnet} fails.
Expand Down Expand Up @@ -382,7 +388,7 @@ poverty lines included in {it:povlines()}:
{stata povcalnet, country(COL BRA ARG IND) year(2015) clear aggregate}

{phang}
2.4. World Bank aggregation ({it:country()} is not avialable)
2.4. World Bank aggregation ({it:country()} is not available)

{phang2}
{stata povcalnet wb, clear year(2015)}{p_end}
Expand Down Expand Up @@ -436,7 +442,7 @@ poverty lines included in {it:povlines()}:
. keep if _tokeepl == 1
. drop _*

{txt} ({stata "povcalnet_examples example08":click to run})
{txt} ({stata "povcalnet_examples pcn_example08":click to run})

{phang2}
{ul:3.2} National coverage (when available) and longest possible time series for each country, restrict to same welfare type throughout.
Expand Down Expand Up @@ -469,7 +475,7 @@ poverty lines included in {it:povlines()}:
. keep if _tokeepl == 1
. drop _*

{txt} ({stata "povcalnet_examples example09":click to run})
{txt} ({stata "povcalnet_examples pcn_example09":click to run})

{dlgtab: 4. Analytical examples}

Expand Down Expand Up @@ -500,7 +506,7 @@ poverty lines included in {it:povlines()}:
. 2 "Number of people who live below $1.90") si(vsmall) ///
. row(2)) scheme(s2color)

{txt} ({stata "povcalnet_examples example01":click to run})
{txt} ({stata "povcalnet_examples pcn_example01":click to run})

{phang2}
{ul:4.2} Graph of trends in poverty headcount ratio by region, multiple poverty lines ($1.9, $3.2, $5.5)
Expand All @@ -527,7 +533,7 @@ poverty lines included in {it:povlines()}:
. yti("Poverty headcount (%)", si(vsmall)) ///
. leg(order(1 "$1.9" 2 "$3.2" 3 "$5.5") r(1) si(vsmall)) ///
. sub(, si(small)) scheme(s2color)
{txt} ({stata "povcalnet_examples example07":click to run})
{txt} ({stata "povcalnet_examples pcn_example07":click to run})

{phang2}
{ul:4.3} Millions of poor by region
Expand Down Expand Up @@ -564,7 +570,7 @@ poverty lines included in {it:povlines()}:
. graphregion(c(white)) ysize(7) xsize(8) ///
. ylabel(,labs(small) nogrid angle(verticle)) xlabel(,labs(small)) ///
. legend(order(`legend') si(vsmall))
{txt} ({stata "povcalnet_examples example02":click to run})
{txt} ({stata "povcalnet_examples pcn_example02":click to run})

{phang2}
{ul:4.4} Graph of population distribution across income categories in Latin America, by country
Expand Down Expand Up @@ -601,7 +607,7 @@ poverty lines included in {it:povlines()}:
. graphregion(c(white)) ysize(6) xsize(6.5) ///
. legend(si(vsmall) r(3)) yti("`yti'", si(small)) ///
. ylab(,labs(small) nogrid angle(0)) scheme(s2color)
{txt} ({stata "povcalnet_examples example03":click to run})
{txt} ({stata "povcalnet_examples pcn_example03":click to run})



Expand All @@ -628,7 +634,7 @@ Note, No. 9, World Bank, Washington, DC
{browse "http://documents.worldbank.org/curated/en/docsearch/collection-title/Global%2520Poverty%2520Monitoring%2520Technical%2520Note?colT=Global%2520Poverty%2520Monitoring%2520Technical%2520Note":Link}{p_end}

{marker acknowled}{...}
{title:Acknowledgements}
{title:Acknowledgments}
{p 40 20 2}(Go up to {it:{help povcalnet##sections:Sections Menu}}){p_end}

{pstd}
Expand Down Expand Up @@ -661,7 +667,9 @@ All the files are available in the {browse "https://github.com/worldbank/povcaln
{title:Thanks for citing {cmd:povcalnet} as follows}
{p 40 20 2}(Go up to {it:{help povcalnet##sections:Sections Menu}}){p_end}

{p 4 8 2}Castaneda Aguilar, R. A., C. Lakner, E. B. Prydz, J. S. Lopez, R. Wu and Q. Zhao (2019) "povcalnet: Stata module to access World Bank’s Global Poverty and Inequality data," Statistical Software Components 2019, Boston College Department of Economics.{p_end}
{p 4 8 2}Castaneda Aguilar, R. A., C. Lakner, E. B. Prydz, J. S. Lopez, R. Wu and Q. Zhao
(2019) "povcalnet: Stata module to access World Bank’s Global Poverty and Inequality data,"
Statistical Software Components 2019, Boston College Department of Economics.{p_end}

{pstd}
Please make reference to the date when the database was downloaded, as statistics may change
Expand Down
2 changes: 1 addition & 1 deletion povcalnet_cl.ado
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if ("`povline'" == "") local povline 1.9
if ("`ppp'" == "") local ppp -1
if ("`coverage'" == "") local coverage -1

*---------- download guidence data
*---------- download guidance data
povcalnet_info, clear justdata `pause'
gen n = _n
levelsof country_code, local(countries) clean
Expand Down
Loading

0 comments on commit 683a9f5

Please sign in to comment.