The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Dissemination and Capacity Strengthening » Application Programming Interface (API)  » How to use API to import data to R/Stata
How to use API to import data to R/Stata [message #23049] Thu, 01 July 2021 12:00 Go to next message
Ghose is currently offline  Ghose
Messages: 17
Registered: May 2018

The API feature is new for me so I'd like to know how to load a dataset on R or Stata, let's say for Nepal 2016 IR data.

Any clue is highly appreciated.

Re: How to use API to import data to R/Stata [message #23050 is a reply to message #23049] Thu, 01 July 2021 14:43 Go to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 800
Registered: January 2013
Senior Member
The API is not designed for loading datasets into R or Stata. The API is used to provide aggregated indicator data to tools such as STATcompiler or the DHS mobile app. It can also be used to download aggregated data (not the micro data) in Stata or R, or other tools. You can find out about the API at There are some code samples on the API site for using the API in R or Stata.

However, there is a tool called rdhs developed by Oliver Watson and Jeff Eaton that does permit downloading and using DHS datasets directly in R, and this makes use of the API to find information about the datasets and about indicators. This also includes a number of vignettes about how to use rdhs, including an introduction vignette.
Previous Topic: is "perpage" query param supported for data API?
Next Topic: Child health data
Goto Forum:

Current Time: Wed Jul 24 01:04:24 Coordinated Universal Time 2024