[R] Cannot read XPT file using foreign package

Dennis Fisher
Fri, 04 Oct 2013 22:50:47 -0000

OS X 10.8
R 3.0.1
foreign 0.8-55 (2013-09-02)

Colleagues,

I received a SAS XPT file that I cannot read using the foreign package.
The command:
	read.xport(FILENAME)
results in the following message:
	Error in lookup.xport(file) : file not in SAS transfer format
I am able to read the file successfully using StatTransport so it appears that
the file is OK.

When I examine the file using "more", the first few lines look like
this:
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@04Oct13:11:15:5904Oct13:11:15:59
HEADER RECORD*******MEMBER  HEADER RECORD!!!!!!!000000000000000001600000000140
HEADER RECORD*******DSCRPTR HEADER RECORD!!!!!!!000000000000000000000000000000
SAS     SAS     SASDATA 6.06    bsd4.2
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@04Oct13:11:15:5904Oct13:11:15:59
HEADER RECORD*******NAMESTR HEADER RECORD!!!!!!!000000000500000000000000000000
^@^A^@^@^@^H^@^ASubject Subject                                 BEST
^@^L^@^@^@^@^@^@        ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^A^@^@^@^H^@^BPeriod
Period                                  BEST    ^@^L^@^@^@^@^@^@
^@^@^@^@^@^@^@^H^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@

Of course, I can use StatTransport to write the file to another format.
However, I would like to understand why the foreign package is unable to process
the file.

Any help would be greatly appreciated.

Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com




	[[alternative HTML version deleted]]