1

Edit: I know that this question is marked duplicate but I don't think it is and I still do not have a response that I find adequate so I reframed the question to try and make it clear exactly what I want and that I do not have any version of stata.

I need to convert a Stata 13 .dta file to a CSV using R. I do not have any version of stata (so I can't save as CSV file using stata). The following commands in R do not work for stata 13 (only for stata 12 or lower)

library(foreign)
yourData <- read.dta("yourStataFile.dta")
user103828
  • 156
  • 8
  • Unfortunately, I don't have stata so I can't convert to stata 12 first like the solution to "Read Stata file in R" suggests. I need to do everything in R (or some other way not using stata). – user103828 Jun 17 '14 at 10:41
  • 1
    [This SO thread](http://stackoverflow.com/questions/2536047/convert-dta-file-to-csv) suggests you might be able to use software from [here](http://am.air.org/) to do the conversion (I haven't tried it). – hrbrmstr Jun 17 '14 at 11:10
  • thanks... my preference is to use R (or MATLAB for that matter) if possible but I might have to try the software. – user103828 Jun 17 '14 at 11:18
  • Never write from scratch what has already been implemented :-). `R` can always issue a system call to run the external translator app. – Carl Witthoft Jun 17 '14 at 11:36
  • If you've successfully read in `yourData`, can't you just save it to a file via `write.table` and kin? – Roman Luštrik Jun 17 '14 at 12:25
  • I haven't been able to successfully sav as yourData. The commands in R don't work for stata 13. – user103828 Jun 18 '14 at 07:27
  • @CarlWitthoft, what do you mean by "R can always issue a system call to run the external translator app" and how do I do this? thanks. – user103828 Jul 02 '14 at 09:01
  • Have you tried Python with pandas? See this post: http://stackoverflow.com/questions/24053652/pandas-and-stata-13-files/24062015#24062015. There was a problem with pandas reading Stata 13 files, but they claim a fix here: https://github.com/pydata/pandas/issues/7360. Take a look and see if it works for you. – Roberto Ferrer Jul 02 '14 at 14:21
  • Can try Python's `pandas.read_stata` command if your in a bind. – Nicolas Aug 18 '18 at 11:05

0 Answers0