diff --git a/povcalnet.ado b/povcalnet.ado index 911d218..0f58f0b 100644 --- a/povcalnet.ado +++ b/povcalnet.ado @@ -31,6 +31,7 @@ COUNtry(string) /// REGion(string) /// YEAR(string) /// POVline(numlist) /// +POPShare(numlist) /// PPP(numlist) /// AGGregate /// CLEAR /// @@ -281,8 +282,29 @@ qui { } } - *---------- Poverty line - if ("`povline'" == "") local povline = 1.9 + *---------- Poverty line/population share + + // Blank popshare and blank povline = default povline 1.9 + if ("`popshare'" == "" & "`povline'" == "") { + local povline = 1.9 + local pcall = "povline" + } + + // defined popshare and defined povline = error + else if ("`popshare'" != "" & "`povline'" != "") { + noi disp as err "povline and popshare cannot be used at the same time" + error + } + + // blank popshare and defined povline + else if ("`popshare'" == "" & "`povline'" != "") { + local pcall = "povline" + } + + // defined popshare and blank povline + else { + local pcall = "popshare" + } *---------- Info if regexm("`subcommand'", "^info") { @@ -405,7 +427,10 @@ qui { local f = 0 - foreach i_povline of local povline { + if ("`pcall'" == "povline") loc i_call "i_povline" + else loc i_call "i_popshare" + + foreach `i_call' of local `pcall' { local ++f /*================================================== @@ -415,6 +440,7 @@ qui { region("`region'") /// year("`year'") /// povline("`i_povline'") /// + popshare("`i_popshare'") /// ppp("`i_ppp'") /// coverage(`coverage') /// server(`server') /// @@ -433,16 +459,23 @@ qui { local query_pl = "`r(query_pl)'" local query_ds = "`r(query_ds)'" local query_pp = "`r(query_pp)'" + local query_ps = "`r(query_ps)'" return local query_ys_`f' = "`query_ys'" return local query_ct_`f' = "`query_ct'" return local query_pl_`f' = "`query_pl'" return local query_ds_`f' = "`query_ds'" return local query_pp_`f' = "`query_pp'" + return local query_ps_`f' = "`query_ps'" return local base = "`base'" *---------- Query - local query = "`query_ys'&`query_ct'&`query_pl'`query_pp'`query_ds'&format=csv" + if ("`popshare'" == ""){ + local query = "`query_ys'&`query_ct'&`query_pl'`query_pp'`query_ds'&format=csv" + } + else{ + local query = "`query_ys'&`query_ct'&`query_ps'`query_pp'`query_ds'&format=csv" + } return local query_`f' "`query'" global pcn_query = "`query'" @@ -501,6 +534,7 @@ qui { if ("`query_ys'" != "") noi di as res "Year:" as txt "{p 4 6 2} `query_ys' {p_end}" if ("`query_ct'" != "") noi di as res "Country:" as txt "{p 4 6 2} `query_ct' {p_end}" if ("`query_pl'" != "") noi di as res "Poverty line:" as txt "{p 4 6 2} `query_pl' {p_end}" + if ("`query_ps'" != "") noi di as res "Population share:" as txt "{p 4 6 2} `query_ps' {p_end}" if ("`query_ds'" != "") noi di as res "Aggregation:" as txt "{p 4 6 2} `query_ds' {p_end}" if ("`query_pp'" != "") noi di as res "PPP:" as txt "{p 4 6 2} `query_pp' {p_end}" noi di as res _dup(20) "-" diff --git a/povcalnet.sthlp b/povcalnet.sthlp index a064313..2c9dee1 100644 --- a/povcalnet.sthlp +++ b/povcalnet.sthlp @@ -39,6 +39,8 @@ 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} + {synoptset 27 tabbed}{...} {synopthdr:Options} @@ -202,6 +204,13 @@ When selecting multiple poverty lines, use less than 4 decimals and separate each value with spaces. If left empty, the default poverty line of $1.9 is used. 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. + + + {marker options}{...} {p 40 20 2}(Go up to {it:{help povcalnet##sections:Sections Menu}}){p_end} {title:Options description} diff --git a/povcalnet_query.ado b/povcalnet_query.ado index 7ed784d..35db6c8 100644 --- a/povcalnet_query.ado +++ b/povcalnet_query.ado @@ -11,6 +11,7 @@ version 11.0 COUntry(string) /// REGion(string) /// POVLine(string) /// + POPShare(string) /// PPP(string) /// NOSUMmary /// ISO /// @@ -179,9 +180,17 @@ quietly { } return local query_ct = "`country_q'" - *---------- Poverty lines query - local povline_q = "PovertyLine=`povline'" - return local query_pl = "`povline_q'" + if ("`popshare'" != ""){ + *----------Poppulation share query + local popshare_q = "QP=`popshare'" + return local query_ps = "`popshare_q'" + } + else { + *---------- Poverty lines query + local povline_q = "PovertyLine=`povline'" + return local query_pl = "`povline_q'" + + } } // end of qui