[R] sas.get problem : the saga continues.
jrkrideau at yahoo.ca
Sat Apr 14 04:16:57 CEST 2007
--- "Nordlund, Dan (DSHS/RDA)" <NordlDJ at dshs.wa.gov>
> > -----Original Message-----
> > From: r-help-bounces at stat.math.ethz.ch
> > [mailto:r-help-bounces at stat.math.ethz.ch] On
> Behalf Of John Kane
> > Sent: Friday, April 13, 2007 1:37 PM
> > To: R R-help
> > Subject: Re: [R] sas.get problem : the saga
> > #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
> > 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
> > file which does work with
> > LIBNAME dd1 = 'F:\testsas' . Can anyone see if I
> > misreading the Help or
> > making some kind of stupid typing mistake? I also
> > 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",
> > format.library="F:/testsas",
> > sasprog = '"C:/Program Files/SAS/SAS
> > 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
> > 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)
> 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 :)
More information about the R-help