[R] sas.get problem

Cody_Hamilton at Edwards.com Cody_Hamilton at Edwards.com
Wed Apr 11 19:21:38 CEST 2007


John,

I believe the format file must have a .sc or .sas7bcat  file extension (not
.sas7bdat which is a sas dataset extension).  I think that's why you're
getting the error F:/sas/formats.sc? or formats.sas7bcat not found.

Also, is the carriage return after '"C:/Program  in the code below caused
by copying and pasting into the email or is the code that way in your
program?

Regards,
    -Cody



                                                                           
             John Kane                                                     
             <jrkrideau at yahoo.                                             
             ca>                                                        To 
             Sent by:                  tchur at optusnet.com.au               
             r-help-bounces at st                                          cc 
             at.math.ethz.ch           R R-help <r-help at stat.math.ethz.ch> 
                                                                   Subject 
                                       Re: [R] sas.get problem             
             04/11/2007 07:41                                              
             AM                                                            
                                                                           
                                                                           
                                                                           
                                                                           





--- 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

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list