I wanted to read in a .dta file in R in order to convert it to a .csv file. First, I tried to do so by using the foreign package, but it reported:
Error in read.dta(file): not a Stata version 5-12 .dta file
So I tried to do it by using teh haven package, but that also failed and reported:
Error in df_parse_dta_file(spec, encoding, cols_skip, n_max, skip, name_repair = .name_repair) : Failed to parse C:/Users/folder/data.dta: This version of the file format is not supported
I also tried to convert it with the rio package: install.packages("rio") library(rio) install_formats() convert("file.dta","file.csv")
but it reported:
Error in arg_reconcile(haven::read_dta, file = file, ..., .docall = TRUE, : Failed to parse C:/Users/folder/data.dta: This version of the file format is not supported. This error was generated by: haven::read_dta With the following arguments: "._costs.dta"
Does anyone know how to import such .dta files in R so that one can convert a .csv file ?
PS: The preamble of the .dta-file looks like this:
<stata_dta>118LSFM 23 Apr 2019 16:22