An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101228/4734288d/attachment.pl>
Importing Sas files to R
3 messages · Rekha, Daniel Nordlund, jthetzel
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Rekha
Sent: Monday, December 27, 2010 8:33 PM
To: r-help at r-project.org
Subject: [R] Importing Sas files to R
Dear All,
Am trying to import SAS files to R.
For that i used library "Hmisc" and
try<-sas.get("C:\\ex.sas7bdat") . But it shows error that
Error in sas.get("C:\\ex.sas7bdat") : SAS member name is required
In addition: Warning message:
In sas.get("C:\\ex.sas7bdat") :
C:\ex.sas7bdat/formats.sc? or formats.sas7bcat not found. Formatting
ignored.
Thanks in Advance.
--
*Best Regards,
Reka.
I presume you have SAS installed on your system and the path to the SAS.exe executable is in your Windows path environment variable, and the file, ex.sas7bdat, is in the root directory of your C: dive. You might try something like
try<-sas.get("C:/", "ex")
If SAS is not in your path then you will need to specify where to find it. This would work on my system, your SAS location might be different. The first parameter is libraryName and should contain the Windows directory where your dataset is located. The second parameter is member and should contain the dataset name (without the sas7bdat extension)
try<-sas.get("C:/", "ex", sasprog= "C:/Program Files/SAS/SASFoundation/9.2/sas.exe")
If you don't have access to SAS on your system, this will not work.
Hope this is helpful,
Dan
Daniel Nordlund
Bothell, WA USA
2 days later
Reka, If you do not have SAS available, there is also a free program provided by SAS called the SAS System Viewer, which will export sas7bdata files to csv. N.b. that I've heard it can be buggy if any character variables contain unmatched quotes. I've also read in a previous post (http://r.789695.n4.nabble.com/Reading-sas7bdat-files-directly-td1469515.html) of a program written by Chris Long called dsread (http://www.oview.co.uk/dsread), which will do the trick. I haven't used it yet, but it sounds a lot better than fumbling through the SAS System Viewer. Jeremy Jeremy T. Hetzel Boston University
View this message in context: http://r.789695.n4.nabble.com/Importing-Sas-files-to-R-tp3165690p3168660.html Sent from the R help mailing list archive at Nabble.com.