The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » India » Missing Region for 2015 SPSS India dataset (Only showing individuals from some regions and not others. )
Re: Missing Region for 2015 SPSS India dataset [message #25928 is a reply to message #25926] Mon, 09 January 2023 16:10 Go to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 802
Registered: January 2013
Senior Member
I downloaded the SPSS file and tested this, first in SPSS itself, and then in R. In SPSS I get 699686 cases, and I am seeing data for all states.
I then tested the code you gave in R. First, read.spss is not in the haven package, but in the foreign package. The haven package uses read_spss or read_sav, not read.spss. Also the other parameters are different between the packages.

I was unable to load the data with read.spss from the foreign package. I got the message "Error: cannot allocate vector of size 5.3 Mb".

I then tried with the read_spss from the haven package:
I2015 <- read_spss("C:/Users/21180/OneDrive - ICF/Data/DHS_SPSS/IAIR74FL.SAV", user_na=TRUE)
and it successfully loaded the data showing "699686 obs. of 4796 variables".

I would first try reading the data with read_spss. If you are still only getting 32757 cases, then I think the data file that you have is somehow truncated so I would suggest downloading the dataset from our website again and trying to read it again using read_spss.
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: TV exposure decline and v159 coding error?
Next Topic: survey weights in R
Goto Forum:
  


Current Time: Sun Sep 15 23:19:52 Coordinated Universal Time 2024