Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

Re: [R] sas.get problem : the saga continues.

John Kane

2007-04-13

Replies:


--- "Nordlund, Dan (DSHS/RDA)" <NordlDJ@(protected)>
wrote:

> > -----Original Message-----
> > From: r-help-bounces@(protected)
> > [mailto:r-help-bounces@(protected)
> Behalf Of John Kane
> > Sent: Friday, April 13, 2007 1:37 PM
> > To: R R-help
> > Subject: Re: [R] sas.get problem : the saga
> continues.
> >
> >
> > #Continuing my sas.get saga. Hmisc has been been
> > updated however I am still
> > getting the same problem. I seem to have aa SAS
> > problem as well as
> > an R problem. There seems to be something dodgy
> in
> > the SAS data or
> > format files since SAS will not read the file
> unless I
> > use
> > LIBNAME library = 'F:\testsas'
> > Something like
> > LIBNAME dd1 = 'F:\testsas'
> > will not work and it should whereas Libname
> > dd1="C:\Temp\testsas" does.
> >
> > However I still cannot get sas.get to read a
> simple
> > file which does work with
> > LIBNAME dd1 = 'F:\testsas' . Can anyone see if I
> am
> > misreading the Help or
> > making some kind of stupid typing mistake? I also
> have
> > tried running it on the
> > C drive with no luck. Thanks
> >
> > Windows XP, R 2.4.1
> >
> > ###### EXAMPLE #########
> > #### SAS PROGRAM for simple file. ###
> > libname LIBRARY 'F:\testsas';
> > proc format library= LIBRARY;
> > value catfmt 1 = "Siam"
> >         2 = "Persian"
> >         3 = "Cougar";
> > value dogfmt 1 = "Lab"
> >         2 = "Collie"
> >         3 = "Coyote";
> > run;
> > data library.animals;
> >   input cat dog;
> >   datalines;
> > 1 3
> > 2 2
> > 3 1
> > ;
> >
> > Data LIBRARY.doms;
> > set LIBRARY.Animals ;
> > format cat catfmt. dog dogfmt.;
> > proc freq;
> > run;
> >
> > #####
> > #  Apply sas.get
> >
> > library(Hmisc)
> > mydata <- sas.get(library="F:/testsas",
> mem="doms",
> >         format.library="F:/testsas",
> >  sasprog = '"C:/Program Files/SAS/SAS
> 9.1/sas.exe"')
> >
> > RESULTS
> >
> > > library(Hmisc)
> > > mydata <- sas.get(library="C:/Temp/testsas",
> > mem="doms",
> > +         format.library="C:/Temp/testsas",
> > +  sasprog = '"C:/Program Files/SAS/SAS
> > 9.1/sas.exe"')
> > The filename, directory name, or volume label
> syntax
> > is incorrect.
> > Error in sas.get(library = "C:/Temp/testsas", mem
> =
> > "doms", format.library = "C:/Temp/testsas", :
> >      SAS job failed with status 1
> > In addition: Warning message:
> > 'cmd' execution failed with error code 1 in:
> > shell(cmd, wait = TRUE, intern = output)
>
> John,
>
> You may have missed my earlier post about this. The
> problem you are having with SAS is the value you are
> passing in the sasprog parameter. You need to drop
> the single quotes, like the following
>
> sasprog = "C:/Program Files/SAS/SAS 9.1/sas.exe"

Ah, I'll give it a try. I added those single quotes
based on an early R-list posting suggesting that the
space in "Program Files" was a problem.

Actually by that time I was down to superstitious
learning but the idea seemed reasonable.
>
> sas.get() calls a function, shQuote(), which wraps
> the program name in double quotes and then escapes
> the double quotes you are passing, which messes up
> the program name that Windows sees.

Oh I see what you mean.
>
> I don't understand exactly what problem you are
> having with the library names. If I take your code
> and replace every instance of LIBRARY (in all caps)
> with dd1, your program runs just fine on my WinXP
> Pro system.

I am not sure either but I suspect that SAS does not
tollerate such new-fangled things as USB sticks. Try
it on a USB and see what happens. Things seem to work
just fine on a hard drive. Currently I am blaming the
problem on SAS's outdated view of the world :) .

Most of my SAS (as opposed to R problems) seem to
disappear when I move the files to the C: drive.
Something I should have thought of sooner.


>If changing the sasprog parameter value
> as above doesn't work, write back to the R-help with
> the errors you get and someone (maybe even me :-)
> should be able to help.

Thanks, you have been very helpful already. Stand by
for the difficult questions :)

______________________________________________
R-help@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.