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)
Re: Generate percent of respondents by background characteristics-Resolved [message #24250 is a reply to message #24245] Tue, 29 March 2022 13:29 Go to previous message
DHSuser_NY is currently offline  DHSuser_NY
Messages: 8
Registered: November 2019
Member
I was able to figure this out. Sharing Stata code in case it is useful for anyone else. I needed to use the background indicator for percent of women(SV_BACK_W_PCW) and specify breakdown = all. This gave me some categories I don't need like education and region, but I just deleted them in Stata.


* Background characteristics table for most recent surveys 2006-2022.
import delimited using " https://api.dhsprogram.com/rest/dhs/data?surveyYearStart=200 6&surveyYearEnd=2022&breakdown=all&indicatorIds= SV_BACK_W_PCW,&selectSurveys=latest&returnfields=sur veyId,DHS_CountryCode,CountryName,SurveyYear,SurveyYearLabel ,SurveyType,FieldworkStart,FieldworkEnd,indicator,IndicatorI D,value,shortname,characteristiclabel,characteristicid,chara cteristiccategory,&f=csv&apiKey=GUTTMA-130129", clear

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


Current Time: Thu Apr 25 12:18:03 Coordinated Universal Time 2024