[R] Failure of sas7bdat package

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Oct 4 18:52:10 CEST 2012

On Thu, Oct 4, 2012 at 4:55 PM, Fisher Dennis <fisher at plessthan.com> wrote:
> R 2.15.1
> OS 10.7
> Colleagues
> I have been an enthusiastic user of the sas7bdat package in R.  However, several recent sas7bdat files sent to me from different sources cannot be read by the package.  The error message is:
>         Error in read.sas7bdat(FILENAME) :
>   unknown host W32_7PRO please report bugs to sas7bdatRbugs at gmail.com
> I examined the file with a text editor and it contains
>         9.0301M1W32_7PRO
> in the second line.  An older file that works successfully with the package contains
>         9.0101M3XP_PRO
> in the same position.
> Is this causing the failure?  Is this something easy to fix?  For the moment, I am using StatTransfer to convert the files.  StatTransfer has no problem with the newer files suggesting that the problem might be trivial.

 Just having a look at the source code for Matt's sas7bdat package,
there's a special bug report email:

> sas7bdat:::BUGREPORT
[1] "please report bugs to sas7bdatRbugs at gmail.com"

Further, if you read the vignette("sas7bdat") you'll see a lot of
technical stuff that has been reverse engineered about the sas format.
The source code contains this chunk:

# Host systems known to work
               "WIN_ASRV", "XP_PRO", "XP_HOME", "NET_ASRV",
               "NET_DSRV", "NET_SRV", "WIN_98", "W32_VSPR",
               "WIN", "WIN_95", "X64_VSPR", "X64_ESRV")

and it seems your data doesn't have a known host code. I suspect Matt
has never seen a SAS file from a Windows 7 Pro box.

Now, the code currently doesn't do anything dependent on the host,
there's just a cautionary stop() that you have hit. You could edit
read.sas7bdat, remove the stop (or add W32_7PRO to the known hosts),
reinstall, and see if it works.

 Or more hackerly, edit the file and replace W32_7PRO with a valid
KNOWNHOST of exactly the same length (so as not to upset the delicate
binary balance). "W32_VSPR" would work. Be careful editing binary
files with a text editor - it might try to wrap lines or mung your
file in nasty ways.


More information about the R-help mailing list