[R] Problem with sas.get function in Hmisc

Hong Ooi Hong.Ooi at iag.com.au
Thu Dec 14 00:56:33 CET 2006


_______________________________________________________________________________________


After digging around in the sas.get code, I found a change that seems to
be causing the problem:

old version:

    ...
    status <- sys(paste(sasprog, sasin, "-log", log.file),
        output = FALSE)
    ...

new version:

    ...
    status <- sys(paste(shQuote(sasprog), shQuote(sasin), "-log", 
        shQuote(log.file)), output = FALSE)
    ...


For some reason, sys() bombs when given a command string with quotes in
it. The string works fine when pasted into a command line window, so
maybe it's a problem with the WinXP commmand interpreter? In any case,
changing the sys() call to system() seems to fix the problem.

    ...
    status <- system(paste(shQuote(sasprog), shQuote(sasin), "-log", 
        shQuote(log.file)))
    ...


-- 
Hong Ooi
Senior Research Analyst, IAG Limited
388 George St, Sydney NSW 2000
+61 (2) 9292 1566
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jean Vidal
Sent: Wednesday, 13 December 2006 8:02 PM
To: acalatro at rhoworld.com
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Problem with sas.get function in Hmisc

The workaround you point seems to be the solution for the moment.
I not sure I will have time (and courage) to try to figure out where
the bug comes from. Hope a more literate R programmer than me is
willing to dive in...

Thank you for your answer.

2006/12/12, Agustin Calatroni <acalatro at rhoworld.com>:
> Jean, I saw your email to the R-help mailing list. I also notice the
> problem a few months back and email the maintainer (Charles Dupont)
but
> never got a response. Since I used the function a lot and in order to
> avoid the error I use version 3.0-12 instead of updating the a newer
> version. To download the earlier version use the following site:
> http://cran.r-project.org/bin/windows/contrib/2.2/ If you figure out
> another way around the problem I will be interested in knowing the
solution.
>
> Sincerely,
>
>
> -- Agustin Calatroni
>
> Agustin Calatroni wrote:
> > I been having the following problem when I updated the Hmisc package
> > from version 3.0-12 to version 3.1-1.
> >
> > Create dataset under SAS:
> > data a;
> >  do i = 1 to 100;
> >   x = rannor(0);
> >   output;
> >  end;
> > run;
> >
> > Hmisc version 3.0-12:
> > library(Hmisc)
> > sas.get('C:\\Documents and Settings\\novell\\My Documents\\SAS
> > Temp\\_TD3428','a')
> >
> > NO PROBLEM
> >
> > Hmisc version 3.1-1:
> > library(Hmisc)
> > sas.get('C:\\Documents and Settings\\novell\\My Documents\\SAS
> > Temp\\_TD3428','a')
> >
> > The filename, directory name, or volume label syntax is incorrect.
> > Error in sas.get("C:\\Documents and Settings\\novell\\My
Documents\\SAS
> > Temp\\_TD3428",  :
> >         SAS job failed with status 1
> > In addition: Warning message:
> > 'cmd' execution failed with error code 1 in: shell(cmd, wait = TRUE,
> > intern = output)
> >
> > R.Version()
> > $platform
> > [1] "i386-pc-mingw32"
> > $arch
> > [1] "i386"
> > $os
> > [1] "mingw32"
> > $system
> > [1] "i386, mingw32"
> > $status
> > [1] ""
> > $major
> > [1] "2"
> > $minor
> > [1] "3.1"
> > $year
> > [1] "2006"
> > $month
> > [1] "06"
> > $day
> > [1] "01"
> > $`svn rev`
> > [1] "38247"
> > $language
> > [1] "R"
> > $version.string
> > [1] "Version 2.3.1 (2006-06-01)"
> >
> > Thanks for Hmisc and Design packages, they are an invaluable
resource.
> > Sorry if this is a stupid question and I missed something obvious.
> >
>
>

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

_______________________________________________________________________________________

The information transmitted in this message and its attachme...{{dropped}}



More information about the R-help mailing list