The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » India » How to extract the survey data (Need information on extracting the survey data as a new user)
How to extract the survey data [message #29388] Tue, 11 June 2024 10:06 Go to next message
26tanishabanik is currently offline  26tanishabanik
Messages: 4
Registered: June 2024
Member
Hi,

I was wondering if anyone or who has already explored the datasets guide me in extracting the survey data without using Stata or SPSS software but using a programming language. I have tried using R but since the files are so big, R studio is not able to load it


Thanks,
Tanisha Banik
Re: How to extract the survey data [message #29391 is a reply to message #29388] Tue, 11 June 2024 12:38 Go to previous messageGo to next message
26tanishabanik is currently offline  26tanishabanik
Messages: 4
Registered: June 2024
Member
Also, if someone can guide me with how to get started with analysing the data and making sense out of it
Re: How to extract the survey data [message #29408 is a reply to message #29391] Wed, 12 June 2024 08:46 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3110
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Ali Roghani:

To load a DHS data file directly into R without using Stata or SPSS, you can use the haven package. Here's an example of how to do it:

library(haven) 
data <- read_dta("your_directory/your_file_name.DTA")

You should use your file path in the read_dta function.

[Updated on: Wed, 12 June 2024 13:20]

Report message to a moderator

Re: How to extract the survey data [message #29409 is a reply to message #29408] Wed, 12 June 2024 09:44 Go to previous messageGo to next message
26tanishabanik is currently offline  26tanishabanik
Messages: 4
Registered: June 2024
Member
Hi Bridgette,

I have tried this method using haven package, I got the below error:

Error: vector memory limit of 16.0 Gb reached, see mem.maxVSize()

My system's configurations are attached below

Re: How to extract the survey data [message #29410 is a reply to message #29409] Wed, 12 June 2024 16:25 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3110
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Ali Roghani:

Usually, with `read_dta`, you can import the data. Make sure your data is in DTA format. Two approaches can be helpful in dealing with this technical issue related to the machine/laptop.

First, you can run this code in RStudio:
```R
Sys.setenv(R_MAX_VSIZE = 16e9)
```
You might need to change the size too.

The second approach is:
1. Open Terminal
2. Run the following commands:
   ```sh
   cd ~
   touch .Renviron
   open .Renviron
   ```
3. Save the following as the first line of .Renviron:
   ```sh
   R_MAX_VSIZE=16Gb
   ```
4. Close RStudio and reopen it

You might need to adjust this parameter depending on the specifications of your machine. Please let us know whether one of these approaches works for you.

[Updated on: Thu, 13 June 2024 06:33]

Report message to a moderator

Previous Topic: Multilevel modelling sampling weights
Next Topic: Construction of level weights from individual weights
Goto Forum:
  


Current Time: Thu Jul 11 16:19:30 Coordinated Universal Time 2024