[R] sas.get problem

John Kane jrkrideau at yahoo.ca
Wed Apr 11 16:41:08 CEST 2007


--- Tim Churches <tchur at optushome.com.au> wrote:

> John Kane wrote:
> > I  have 3 SAS files all in the directory F:/sas,
> two
> > data files
> > and a format file :
> > form.ea1.sas7bdat
> > form.ea2.sas7bdat
> > sas.fmts.sas7bdat
> > 
> > F is a USB.

> > I am using R2.4.1 under Windows XP
> > SAS files were created with SAS 9.x
> > They convert easily into SPSS 14

> > Example.
> > 
> > library(Hmisc)
> > mydata <- sas.get(library="F:/sas",
> mem="form.ea1",
> >              format.library="sas.fmts.sas7bdat",
> >            sasprog = '"C:Program Files/SAS/SAS
> > 9.1/sas.exe"')
> > 
> > Error message  (one of several that I have gotten
> > while trying various things.)
> > The filename, directory name, or volume label
> syntax
> > is incorrect.
> > Error in sas.get(library = "F:/sas", mem =
> "form.ea1",
> > format.library = "sas.fmts.sas7bdat",  :
> >         SAS job failed with status 1
> > In addition: Warning messages:
> > 1: sas.fmts.sas7bdat/formats.sc? or
> formats.sas7bcat 
> > not found. Formatting ignored.
> >  in: sas.get(library = "F:/sas", mem = "form.ea1",
> > format.library = "sas.fmts.sas7bdat",
> > 2: 'cmd' execution failed with error code 1 in:
> > shell(cmd, wait = TRUE, intern = output)
> 
> The sas.get function in the Hmisc library is broken
> under Windows.
> 
> Change line 127 from:
> 
>     status <- sys(paste(shQuote(sasprog),
> shQuote(sasin), "-log",
>         shQuote(log.file)), output = FALSE)
> 
> to:
> 
>     status <- system(paste(shQuote(sasprog),
> shQuote(sasin), "-log",
>         shQuote(log.file)))
> 
> Tim C

Thanks Tim, 

How do I make this change? I naively have tried by
a) list sas.get and copy to editor
b) reload R without loading Hmisc
c) made recommended changes to sas.get
d) stuck a "sas.get <- " in front of the function and
ran it. 

R returns the same error messages.  I have also
corrected the typo in sasprog and done some renaming
following Cody's suggestions.  
 
Currently I have:
   formea1.sas7bdat
   formea2.sas7bdat
   formats.sas7bdat

detach("package:Hmisc")
 mydata <- sas.get(library="F:/sas", mem="formea1",
       format.library="F:/sas",
     sasprog = '"C:/Program
Files/SAS/SAS9.1/sas.exe"')

RESULTS
Error in sas.get(library = "F:/sas", mem = "formea1",
format.library = "F:/sas",  : 
        SAS job failed with status -1
In addition: Warning messages:
1: F:/sas/formats.sc? or formats.sas7bcat  not found.
Formatting ignored. 
 in: sas.get(library = "F:/sas", mem = "formea1",
format.library = "F:/sas",  
2: "\"C:/Program not found 
---------------------------------
I really don't see why the sagprog does not work
unless  an early error is falling through.

Thanks for all the help



More information about the R-help mailing list