[R] Importing Sas files to R
Daniel Nordlund
djnordlund at frontier.com
Tue Dec 28 05:55:52 CET 2010
> -----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
More information about the R-help
mailing list