[R] Stata files
I have a client who uses Stata 11. Can anyone advise me on ways of transferring data from this version of Stata to R? Reading the documentation for read.dta in package foreign it seems it only allows for versions up to Stata 10. I don't know Stata at all but a bit of poking around on their website led me to believe Stata 11 couldn't write in Stata 10 format. However Stata 11 can write Excel files in XML, so presumably .xlsx files. Any advice, correction of my misconceptions, etc. gladly received. David Scott _ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142,NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stata files
Have you tried read.dta? The URL on the help page for read.dta now says 'Stata 11 help for dta', but it seems to document the same format (114) as Stata 10 (see the value section). So in so far as Stata is telling us, it looks like Stata 10 and 11 use the same format (as Stata 8 and 9 did). On Wed, 16 Dec 2009, David Scott wrote: I have a client who uses Stata 11. Can anyone advise me on ways of transferring data from this version of Stata to R? Reading the documentation for read.dta in package foreign it seems it only allows for versions up to Stata 10. I don't know Stata at all but a bit of poking around on their website led me to believe Stata 11 couldn't write in Stata 10 format. However Stata 11 can write Excel files in XML, so presumably .xlsx files. I suspect it can write .csv files. See for example http://www.stata.com/help.cgi?outsheet Any advice, correction of my misconceptions, etc. gladly received. David Scott _ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142,NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stata files
On 16 Dec 2009 at 10:24, Prof Brian Ripley wrote: Have you tried read.dta? The URL on the help page for read.dta now says 'Stata 11 help for dta', but it seems to document the same format (114) as Stata 10 (see the value section). So in so far as Stata is telling us, it looks like Stata 10 and 11 use the same format (as Stata 8 and 9 did). That's correct: Stata 10 and Stata 11 use the same file format. If you need a still older format, the -saveold- command in Version 11 of Stata will save a Version 10/11 file in the format that was used by Versions 8 and 9 of Stata. ---JRG On Wed, 16 Dec 2009, David Scott wrote: I have a client who uses Stata 11. Can anyone advise me on ways of transferring data from this version of Stata to R? Reading the documentation for read.dta in package foreign it seems it only allows for versions up to Stata 10. I don't know Stata at all but a bit of poking around on their website led me to believe Stata 11 couldn't write in Stata 10 format. However Stata 11 can write Excel files in XML, so presumably .xlsx files. I suspect it can write .csv files. See for example http://www.stata.com/help.cgi?outsheet Any advice, correction of my misconceptions, etc. gladly received. David Scott _ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142,NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. John R. Gleason Associate Professor Syracuse University 430 Huntington Hall Voice: 315-443-3107 Syracuse, NY 13244-2340 USA FAX: 315-443-4085 PGP public key at keyservers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stata files
Thank you both (JRG and BDR) for the advice. Just to clarify Brian, I don't actually have any example .dta files yet to test. I wanted to be prepared and be able to advise the client what to do. I don't see anything about 'Stata 11 help for dta' Brian: must have a different URL. But I did note already that Stata 11 uses format 114 which I agree indicates 10 and 11 use the same format. David JRG wrote: On 16 Dec 2009 at 10:24, Prof Brian Ripley wrote: Have you tried read.dta? The URL on the help page for read.dta now says 'Stata 11 help for dta', but it seems to document the same format (114) as Stata 10 (see the value section). So in so far as Stata is telling us, it looks like Stata 10 and 11 use the same format (as Stata 8 and 9 did). That's correct: Stata 10 and Stata 11 use the same file format. If you need a still older format, the -saveold- command in Version 11 of Stata will save a Version 10/11 file in the format that was used by Versions 8 and 9 of Stata. ---JRG On Wed, 16 Dec 2009, David Scott wrote: I have a client who uses Stata 11. Can anyone advise me on ways of transferring data from this version of Stata to R? Reading the documentation for read.dta in package foreign it seems it only allows for versions up to Stata 10. I don't know Stata at all but a bit of poking around on their website led me to believe Stata 11 couldn't write in Stata 10 format. However Stata 11 can write Excel files in XML, so presumably .xlsx files. I suspect it can write .csv files. See for example http://www.stata.com/help.cgi?outsheet Any advice, correction of my misconceptions, etc. gladly received. David Scott _ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142,NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. John R. Gleason Associate Professor Syracuse University 430 Huntington Hall Voice: 315-443-3107 Syracuse, NY 13244-2340 USA FAX: 315-443-4085 PGP public key at keyservers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- _ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142,NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.