The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Dissemination and Capacity Strengthening » Application Programming Interface (API)  » getting indicator by only selected background characteristics
getting indicator by only selected background characteristics [message #6806] Fri, 17 July 2015 16:30 Go to next message
ychoi is currently offline  ychoi
Messages: 4
Registered: April 2014
Member
Hi,

I'm tyring to get estimates for an indicator ONLY at the national level AND by wealth quintile. I do not want other disaggregated estimates (e.g., by subnational region, as they take up the number of record/data greatly...). How can I do that? I see only "breakdown=all" (which gives all possible disaggregated estimates) or "breakdown=subnational" (which gives estimates by sub-national administrative unit). Many thanks in advance for help!

FYI, I'm using STATA, and here's my example.
************************************************************ ***********************************
insheetjson using " http://api.dhsprogram.com/rest/dhs/data?indicatorIds=3420200 0&breakdown=national&perpage=1000",

gen str9 surveyid=""
gen str20 group=""
gen str20 grouplabel=""
gen str5 value=""

#delimit;
insheetjson surveyid group grouplabel value
using " http://api.dhsprogram.com/rest/dhs/data?indicatorIds=3420200 0&breakdown=national&perpage=1000",
table(Data)
col(SurveyId CharacteristicCategory CharacteristicLabel Value );
#delimit cr

tab group,

Re: getting indicator by only selected background characteristics [message #6833 is a reply to message #6806] Mon, 20 July 2015 15:23 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 787
Registered: January 2013
Senior Member
Hi YJ

In the current version of the API it is not possible to select just the wealth quintile data and the national data. Currently the best thing to do is to use "breakdown=all" and then filter the selection for the characteristics that you want.

This is an issue we are aware of and we can provide further filtering. If you have specific suggestions of what you would like to see we can add this in a future update to the API.

Regards. Trevor
Re: getting indicator by only selected background characteristics [message #6839 is a reply to message #6833] Tue, 21 July 2015 08:17 Go to previous messageGo to next message
ychoi is currently offline  ychoi
Messages: 4
Registered: April 2014
Member
Thank you very much for clarification, Trevor!
Re: getting indicator by only selected background characteristics [message #8330 is a reply to message #6833] Fri, 09 October 2015 14:49 Go to previous messageGo to next message
jd.weaver is currently offline  jd.weaver
Messages: 5
Registered: April 2015
Location: Seattle, WA
Member
Hi Trevor,

A quick follow-up question on this. Are there any transformations of the numbers from the API if we want to aggregate something like Wealth Quintile to a national level?

thanks!
Re: getting indicator by only selected background characteristics [message #8331 is a reply to message #8330] Fri, 09 October 2015 14:59 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 787
Registered: January 2013
Senior Member
You can't always transform the numbers to get the national totals (at least not easily), but just make the same call to the API with breakdown=national (or leave the breakdown parameter out as this is the default) and you will get the national total.
Re: getting indicator by only selected background characteristics [message #8916 is a reply to message #8331] Wed, 13 January 2016 17:08 Go to previous message
Sarah is currently offline  Sarah
Messages: 2
Registered: March 2013
Location: Calverton, MD, USA
Member
Note: The DHS API can now return csv files. This makes Stata usage much easier. The variables import seamlessly. And in my experience the numbers import in the correct format, no need for conversion. Use the "import delimited" command for a csv request.

For example, to get modern CPR by background characteristics among married women in Burkina Faso:

import delimited " http://api.dhsprogram.com/rest/dhs/data?breakdown=background &indicatorIds=FP_CUSM_W_MOD&countryIds=BF&perpag e=200&f=csv", clear

Cheers,
Sarah
Previous Topic: Welcome to The DHS Program API
Next Topic: Record Limits
Goto Forum:
  


Current Time: Thu Mar 28 17:42:58 Coordinated Universal Time 2024