The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Dissemination and Capacity Strengthening » Application Programming Interface (API)  » Generate percent of respondents by background characteristics (Demographics using API)
Generate percent of respondents by background characteristics [message #24245] Mon, 28 March 2022 17:29 Go to previous message
DHSuser_NY is currently offline  DHSuser_NY
Messages: 5
Registered: November 2019
Member
Good afternoon,

The attached table was created in StatCompiler showing percent of respondents by background demographics(age,residence,marital and wealth) using the the link below which StatCompiler generates when you share the tables. Because this is a table we run quite frequently for different surveys, using the link was a real time-saver.
https://www.statcompiler.com/en/#cc=GM,LB,RW&ucc=&ic =SV_BACK_W_PCW&scl=10000,9001,9002,9003,3001,3002,6001,6 002,6003,6004,6005,15000,15001,15002,15003,15004,16001,16002 &dt=0&pt=0&ss=1&levelRank=0&si=SV_BACK_W _PCW&sbv= .

I would like to extract the same data using API which I am fairly new to. The following call in Stata only gives me wealth and marital status because I have not been able to identify the needed variables for residence(urban/rural) and 5-year age groups. Does anyone know if this information can be extracted from API?

import delimited using ///
" http://api.dhsprogram.com/rest/dhs/data?surveyYearStart=2006 &surveyYearEnd=2022&breakdown=national&indicator Ids=MA_MSTA_W_NMA,MA_MSTA_W_MAR,MA_MSTA_W_LTG,MA_MSTA_W_DIV, MA_MSTA_W_SEP,MA_MSTA_W_WID,MA_MSTA_W_UNI,MA_MSTA_W_MIS,HC_W IXQ_P_LOW,HC_WIXQ_P_2ND,HC_WIXQ_P_MID,HC_WIXQ_P_4TH,HC_WIXQ_ P_HGH,&selectSurveys=latest&returnfields=surveyId,DH S_CountryCode,CountryName,SurveyYear,SurveyYearLabel,SurveyT ype,FieldworkStart,FieldworkEnd,indicator,IndicatorID,value, shortname&f=csv&apiKey=GUTTMA-130129", clear

Thanks for your help.

[Updated on: Mon, 28 March 2022 17:30]

Report message to a moderator

 
Read Message
Read Message
Previous Topic: Child health data
Next Topic: Source of contraception by method
Goto Forum:
  


Current Time: Sun Jul 3 00:47:06 Coordinated Universal Time 2022