[R] export to a dat file that SAS can read

Thomas Lumley tlumley at u.washington.edu
Wed Jun 13 15:53:03 CEST 2007


On Wed, 13 Jun 2007, Uwe Ligges wrote:
>
>
> Rina Miehs wrote:
>> Hello
>>
>> i have a data frame in R that some SAS users need to use in their
>> programs, and they want it in a dat file, is that possible?
>
> What is a "dat" file?
>
>
>> and which functions to use for that?
>
> I *guess* write.table() will do the trick, given "dat" is what I guess
> it is...

Another approach (that preserves factor levels if you have them) is to use 
write.foreign in the 'foreign' package. This writes a text file for the 
data and also writes SAS code to read the file.

 	-thomas



More information about the R-help mailing list