An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120706/180111a1/attachment.pl>
How to import SAS data in R?
7 messages · C W, Jeff Newmiller, Duncan Murdoch +3 more
You need to learn how to search.
RSiteSearch("SAS")
or
Google : R "read SAS"
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
C W <tmrsg11 at gmail.com> wrote:
Hi all I have a large SAS data set, how do I get it read in R? The data is too big (about 400,000 rows by 100 columns) to be saved as an Excel file. How should I get it read in R? Any packages? I don't seem to find any. Thanks, Mike [[alternative HTML version deleted]]
______________________________________________ R-help at 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.
On 06/07/2012 1:11 PM, C W wrote:
Hi all I have a large SAS data set, how do I get it read in R? The data is too big (about 400,000 rows by 100 columns) to be saved as an Excel file. How should I get it read in R? Any packages? I don't seem to find any.
You could write it out in some plain delimited format, e.g. CSV or tab-delimited. Watch out for special characters in strings that confuse R when it reads it in (e.g. commas in unquoted CSV strings, quotes within strings, etc.) Duncan Murdoch
On Jul 6, 2012, at 12:11 PM, C W wrote:
Hi all I have a large SAS data set, how do I get it read in R? The data is too big (about 400,000 rows by 100 columns) to be saved as an Excel file. How should I get it read in R? Any packages? I don't seem to find any. Thanks, Mike
Strangely enough, there is an entire manual on importing and exporting data to/from R: http://cran.r-project.org/manuals.html Several suggestions there for SAS in the relevant manual: http://cran.r-project.org/doc/manuals/R-data.html#Importing-from-other-statistical-systems Regards, Marc Schwartz
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120706/5b6bd8df/attachment.pl>
On Jul 6, 2012, at 1:39 PM, C W wrote:
Quick question, what the memory size in R? I converted to CSV, but only 53300 of the 1,000,000 rows were read in. Did R run out of memory? If so, is there a work around?
You probably have mismatched quotes. Consider using quote="". Also consider doing this: table(count.fields(file-name)) # with a valid file name That count.fields function is very useful since it accepts the same arguments as the read.tables functions, with defaults of: quote = "\"'", skip = 0, blank.lines.skip = TRUE, comment.char = "#")
David. > > Thanks, > Mike > > On Fri, Jul 6, 2012 at 1:24 PM, Duncan Murdoch <murdoch.duncan at gmail.com > >wrote: > >> On 06/07/2012 1:11 PM, C W wrote: >> >>> Hi all >>> I have a large SAS data set, how do I get it read in R? >>> >>> The data is too big (about 400,000 rows by 100 columns) to be >>> saved as an >>> Excel file. How should I get it read in R? Any packages? I >>> don't seem >>> to >>> find any. >>> >> >> You could write it out in some plain delimited format, e.g. CSV or >> tab-delimited. Watch out for special characters in strings that >> confuse R >> when it reads it in (e.g. commas in unquoted CSV strings, quotes >> within >> strings, etc.) >> >> Duncan Murdoch >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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 Winsemius, MD West Hartford, CT
2 days later
In addition to the helpful guidance suggested already, you might investigate the sas7bdat package, by Matt Shotwell. I described it here: http://sas-and-r.blogspot.com/2011/07/really-useful-r-package-sas7bdat.html Ken -- View this message in context: http://r.789695.n4.nabble.com/How-to-import-SAS-data-in-R-tp4635637p4635850.html Sent from the R help mailing list archive at Nabble.com.