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

From: Thomas Lumley <>
Date: Wed, 13 Jun 2007 06:53:03 -0700 (PDT)

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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 13 Jun 2007 - 14:25:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Jun 2007 - 14:31:55 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.