Skip to content

Part II Re: [R] read.ssd {foreign} (Reading a permanent SAS d ataset into an R data frame)

5 messages · Thomas Lumley, Stephen Arthur

#
Thanks
I did do that originally, I just mis-tpyed it, and it
did not work.

I talked with people at SAS, and they said the PROC
COPY SAS code was good, but that I just need to play
around with the R parameters for read.ssd

Will get back to you on this issue.

If you have any additional suggestions, please send
them.
--- "Pfaff, Bernhard" <Bernhard.Pfaff at drkw.com> wrote:
read.ssd("J:\\QM\\Reports\\Sarthur\\SAS_Application\\SAS_Data_Sets","use")
#
On Fri, 20 Dec 2002, Stephen Arthur wrote:

            
If the SAS code is good then just using it in SAS seems like a useful
workaround.

	-thomas
#
Thomas,

Your point is well taken.  I spoke with the people at
SAS again, and they said that a reason why I was
having a problem with the SAS xpt file, is that my
variable names are sometimes longer than 8 characters
long.

PROC COPY puts a limit of 8 characters length to
variable names.  Does R have a limit to the length of
variable names?

Instead, I used PROC CPORT, which can handle variable
names longer than 8 characters long, successfully.

proc cport library=src2rd file=tranfile;
 select use;
run;

But now, when I try to use the R function
'read.xport', I get the following error message:

read.xport("J:\\QM\\Reports\\Sarthur\\SAS_Application\\SAS_Data_Sets\\use")

Error in lookup.xport(file) : unable to open file

Thanks,

Stephen
--- Thomas Lumley <tlumley at u.washington.edu> wrote:
#
On Fri, 20 Dec 2002, Stephen Arthur wrote:

            
No. (well, it probably does but it's so long I don't know what it is)
That means R can't find the file.  Are you sure it's there?

	-thomas
#
Thomas,

The SAS data set I PROC CPORTed is [9] the result is
[10].  I PROC CIMPORTed  [10] back to its orginal
state [9], and it worked. 

So the SAS people think that the error is not with the
SAS XPORT file, but with R trying to load a text SAS
XPORT file, when it should be loading the SAS XPORT
file in binary format?  Is this a problem?

Here is a list of my commands to R:
list.files("J:\\QM\\Reports\\Sarthur\\SAS_Application\\SAS_Data_Sets")

[1]...
[9] "comm_acq_inj.sas7bdat"
[10] "cport.xpt"       
...[66]
read.xport("J:\\QM\\Reports\\Sarthur\\SAS_Application\\SAS_Data_Sets\\cport.xpt")
Error in lookup.xport(file) : File not in SAS transfer
format
--- Thomas Lumley <tlumley at u.washington.edu> wrote:
I am sure that the "cport.xpt" file is in the correct
directory.

Thanks for your assistance in this matter,

Stephen