[R] suggestions about import SAS results to R.

Frank Harrell f.harrell at vanderbilt.edu
Thu Jan 3 15:07:49 CET 2013


SAS' export to csv is buggy (improper quote matching, etc.).  Instead
consider having SAS create a version 5 transport file, then use the Hmisc
package's sasxport.get function to handle labels, etc.
Frank

Ista Zahn wrote
> Well it was worth a try. If you haven't solved the problem some other
> way I suggest exporting from SAS to a plain text format like .csv and
> read into R with read.table.
> 
> Best,
> Ista
> 
> On Wed, Jan 2, 2013 at 5:44 PM, Yuan, Rebecca
> <

> rebecca.yuan@

> > wrote:
>> Hello Ista,
>>
>> Thanks for mention this package, however, it will not support big file,
>> where I got the error message:
>>
>> ----------------------
>> Error in read.sas7bdat("C:/Documents and Settings/test.sas7bdat") :
>>   big endian files are not supported
>> ----------------------
>>
>> Cheers,
>>
>> Rebecca
>>
>> -----Original Message-----
>> From: Ista Zahn [mailto:

> istazahn@

> ]
>> Sent: Wednesday, January 02, 2013 5:25 PM
>> To: Yuan, Rebecca
>> Cc: R help; 

> sas-l at .uga

>> Subject: Re: [R] suggestions about import SAS results to R.
>>
>> Hi Rebecca,
>>
>> I've had success with the sas7bdat package (
>> http://cran.r-project.org/web/packages/sas7bdat/ )
>>
>> Best,
>> Ista
>>
>> On Wed, Jan 2, 2013 at 5:15 PM, Yuan, Rebecca <

> rebecca.yuan@

> > wrote:
>>> Hello all,
>>>
>>> Thanks for the suggestions.
>>>
>>> I tried to import data from sas to R using foreign package. In the
>>> first step, I tried to use read.ssd() to convert the sas file
>>> sales.sas7bdat to SAS Transport formats. But I got an error message as
>>> ---------------------------------------------------------------
>>>> source("testss.r")
>>> Error in file.symlink(oldPath, linkPath) :
>>>   symbolic links are not supported on this version of Windows
>>> ---------------------------------------------------------------
>>>
>>> While in testss.r,
>>>
>>> ---------------------------------------------------------------
>>> require(foreign)
>>> rm(list=ls())
>>> sashome <- "C:/Program Files/SAS/SASFoundation/9.2/"
>>> checkfile <- read.ssd("C:/Documents and Settings/test","sales",sascmd
>>> = file.path(sashome, "sas.exe"))
>>> ---------------------------------------------------------------
>>>
>>> I am using windows xp and R 2.15.2.
>>>
>>> Thanks!
>>>
>>> Rebecca
>>>
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: 

> mehmet.suzen@

>  [mailto:

> mehmet.suzen@

> ] On Behalf
>>> Of Suzen, Mehmet
>>> Sent: Wednesday, January 02, 2013 4:14 PM
>>> To: David Winsemius
>>> Cc: Yuan, Rebecca; R help; 

> sas-l at .uga

>>> Subject: Re: [R] suggestions about import SAS results to R.
>>>
>>>> On Jan 2, 2013, at 12:37 PM, Yuan, Rebecca wrote:
>>>>> I am wondering if there is an efficient way to read SAS data directly
>>>>> in R, or what would be a better connection between SAS and R if I need
>>>>> to use R to deal with data achieved from SAS?
>>>>>
>>>
>>> You may try foreign and SASxport packages:
>>> http://cran.r-project.org/web/packages/foreign/index.html
>>> http://cran.r-project.org/web/packages/SASxport/index.html
>>>
>>> But I heard that there might be some issues with the newest SAS version
>>> but give it a try...
>>>
>>> ----------------------------------------------------------------------
>>> This message, and any attachments, is for the intended
>>> r...{{dropped:2}}
>>>
>>> ______________________________________________
>>> 

> R-help@

>  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.
>>
>> ----------------------------------------------------------------------
>> This message, and any attachments, is for the intended...{{dropped:6}}
> 
> ______________________________________________

> R-help@

>  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.





-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: http://r.789695.n4.nabble.com/suggestions-about-import-SAS-results-to-R-tp4654444p4654521.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list