Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_stata() fails to read Stata 14.0 file format #75

Closed
dalewsteele opened this issue Jun 3, 2015 · 7 comments
Closed

read_stata() fails to read Stata 14.0 file format #75

dalewsteele opened this issue Jun 3, 2015 · 7 comments

Comments

@dalewsteele
Copy link

@dalewsteele dalewsteele commented Jun 3, 2015

When I import the comma delimited file appended at the end, then save using Stata IC 14.0, read_stata fails to parse the resulting .dta file.

Stata code:
import delimited using "ct_race_chd.csv"
save "ct_race_chd.dta", replace
use "ct_race_chd.dta"

Dropbox link to the file created:
https://www.dropbox.com/s/t89lbnlhlm3nslc/ct_race_chd.dta?dl=0

R code:

library(haven)
ct <- read_stata("ct_race_chd.dta")
Error: Failed to parse /home/dsteele/Dropbox/MOOC/ALR/ct_race_chd.dta: Invalid file, or file has unsupported features.

----------------------- ct_race_chd.csv
race,chd,freq
1,1,5
1,0,20
2,1,20
2,0,10
3,1,15
3,0,10
4,1,10
4,0,10

@dalewsteele
Copy link
Author

@dalewsteele dalewsteele commented Jun 4, 2015

If saved in Stata v12 or v13 format, "saveold "ct_race_chd.dta", version(13) "

then haven parses without error

Seems haven is not able to parse Stata v. 14 data files.

@dalewsteele dalewsteele changed the title read_stata() fails to read simple Stata file read_stata() fails to read Stata 14.0 file format Jun 4, 2015
@hadley
Copy link
Member

@hadley hadley commented Jun 5, 2015

@evanmiller is this a known limitation of readstat?

@evanmiller
Copy link
Collaborator

@evanmiller evanmiller commented Jun 5, 2015

It's known now :-).

I previously tried adding support by studying the docs, but I haven't had an actual file to work with until now. I'll report my progress over here:

WizardMac/ReadStat#27

@evanmiller
Copy link
Collaborator

@evanmiller evanmiller commented Jun 5, 2015

Ok, the sample file now opens with ReadStat as of commit WizardMac/ReadStat@bad9575

@dalewsteele
Copy link
Author

@dalewsteele dalewsteele commented Jun 7, 2015

fwiw, Stata provides a detailed description of the .dta format. See:

https://www.dropbox.com/s/2hubfl23b28bsdq/dta_14.pdf?dl=0

@hadley hadley closed this in cd623bb Jun 19, 2015
@hadley
Copy link
Member

@hadley hadley commented Jun 19, 2015

@dalewsteele please try with the dev version, and let us know if it still fails

@dalewsteele
Copy link
Author

@dalewsteele dalewsteele commented Jun 20, 2015

Excellent - the example Stata 14. format file loads fine with latest dev version (haven_0.2.0.9000)

@lock lock bot locked and limited conversation to collaborators Jun 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants