Saikat Debroy
2002-Dec-21  01:21 UTC
Part II Re: [R] read.ssd {foreign} (Reading a permanent SAS d ataset into an R data frame)
>>>>> "Stephen" == Stephen Arthur <sarthur67 at yahoo.com> writes:Stephen> The SAS data set I PROC CPORTed is [9] the result is [10]. Stephen> I PROC CIMPORTed [10] back to its orginal state [9], and it Stephen> worked. Stephen> So the SAS people think that the error is not with the SAS Stephen> XPORT file, but with R trying to load a text SAS XPORT Stephen> file, when it should be loading the SAS XPORT file in Stephen> binary format? Is this a problem? I have no idea what you mean by binary/text SAS XPORT formats. R implements the XPORT format as described in http://ftp.sas.com/techsup/download/technote/ts140.html and that definitely is not a text format.
Thomas Lumley
2002-Dec-21  02:05 UTC
Part II Re: [R] read.ssd {foreign} (Reading a permanent SAS d ataset into an R data frame)
On Fri, 20 Dec 2002, Saikat Debroy wrote:> I have no idea what you mean by binary/text SAS XPORT formats. R > implements the XPORT format as described in > http://ftp.sas.com/techsup/download/technote/ts140.html > and that definitely is not a text format. >Quoth http://www.nber.org/data/sasport.html : --------------- There are two main kinds of SAS portable format datasets. These are CPORT and XPORT. Both are popularly referred to as Transport datasets, but they are quite different, and completely incompatible. The CPORT datasets have the advantage that they can contain a wide variety of SAS objects, not just datasets. However, they have no backwards portability at all. Indeed, I am informed by SAS tech support that even lateral portability is not to be taken for granted. The earliest version of SAS for Unix to be able to read CPORT files generated under MVS 6.07 is 6.07.3 - not the more widespread release 6.07.2. The true portable format is the XPORT format. Supposedly this has full forwards and backwards compatibility (but see below). Only datasets can be transferred with XPORT, not catalogs, formats, etc. This is the format you would use to send data to another site. ---------------------- So CPORT is different, we don't know what the format is, and it may not be documented anywhere. -thomas
Stephen Arthur
2002-Dec-23  19:44 UTC
Part II Re: [R] read.ssd {foreign} (Reading a permanent SAS d ataset into an R data frame)
I'd like to thank the R Core Team for making the
parameters clearer for me on how to solve this
problem.
I think for now I will try to do most data management
tasks in SAS (from Oracle) and then use PROC EXPORT in
SAS to create a csv file that R can read and then I
can do my graphics, for publications and presentations
in R, because I frequently have variable names that
are greater than length 8.
I think this is the best solution for me given my
skills and the level of support I could expect to
receive for problems that are probably not high
priority.  I have written R functions in the past.  I
will have to re-learn how to do that.  This will all
take time.
Using Partha's solution:
* 1) Partha's code in SAS for using PROC EXPORT is:
LIBNAME libref 'C:\Windows\Path';
* 'yourfile' could be permanent or temporary SAS data;
PROC EXPORT DATA=libref.yourfile
 OUTFILE="C:\Windows\Path\yourfile.csv" REPLACE; 
RUN;
* 2) Partha's code in R for importing a csv file is;
yourfile <-
read.csv("C:\\Windows\\Path\\yourfile.csv")
names(yourfile)
yourfile
I thought the task of reading SAS data into R and
separately reading Oracle data into R was going to be
much easier than I now know it is.  I set up an Oracle
to SAS connection and an MS Access to SAS connection
on my system, just reading through notes on the web.
But because I realize R is much more a product of UNIX
than windows regarding database connectivity, I will
have to re-think my strategy.
Stephen
Seemingly Similar Threads
- Part II Re: read.ssd {foreign} (Reading a permanent SAS d ataset into an R data frame)
- reading version 9 SAS datasets in R
- Importing SAS transport data
- reading SAS data files
- Part II Re: read.ssd {foreign} (Reading a permanent SAS d ataset into an R data frame)