Any thoughts on how to apply the codebook formatting to the dataset using R, XML, or SQL?

#1

I don’t have access to SPSS, SAS, or STATA. Would love your input. Note: I’m prepared to write custom code to rebuild the existing basic codebook.

0 Likes

#2

Here is one common method for reading formatted IPUMS data into R:

(1) Select “STATA” as your data format on the extract request screen. This will generate a .dta file when you submit your extract.

(2) In R, use the following code with the name of your .dta file:

library(foreign)

df <- read.dta(“ipums_file.dta”)

This reads your IPUMS file into a dataframe named “df” with value labels applied. I recommend this resource for more information on using IPUMS data in R.

Hope this helps.

0 Likes

#3

Thanks Tim,

The following update to your answer worked perfect:

install.packages(“readstata13”)

library(readstata13)

df <- read.dta13(file = “./some_dir/some_file.dta”)

0 Likes

#4

I wrote a set of Bash/AWK scripts to transform the data and load it into SQLite. Details here: https://github.com/ericnystrom/napptools

0 Likes