[R] Failure of sas7bdat package

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Thu Oct 4 19:07:20 CEST 2012


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Barry Rowlingson
> Sent: Thursday, October 04, 2012 9:52 AM
> To: Fisher Dennis
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Failure of sas7bdat package
> 
> 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
> KNOWNHOST <- c("WIN_PRO", "WIN_NT", "WIN_NTSV", "WIN_SRV",
>                "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.
> 
>  Barry
> 

Dennis,

Looking at the source code on github, Matt has already added W32_7PRO to the list of known hosts.  So, you could download the source tarball and build the package yourself, or just extract the SAS7bdat.R file from the tarball and source it into your R session.  Otherwise, you will probably need to wait for the next update to be submitted to CRAN.

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204




More information about the R-help mailing list