> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of John Kane
> Sent: Wednesday, April 11, 2007 11:30 AM
> To: [EMAIL PROTECTED]
> Cc: R R-help
> Subject: Re: [R] sas.get problem
> 
> 
<<<snip>>>
> 
> Current state of play:
> Files : SAS 9.x
> 
> formea1.sas7bdat
> formea2.sas7bdat
> formats.sas7bcat
> 
> I notice that the formats.sas7bcat is drastically
> different from the sas.bdat
> icons.
> 
> We seem to  be making some progress even if the data
> file still has not loaded.
> 
> In the ammended sas.get condition I get an error
> object ".R." not found.
> I hope this is not an Hmisc object.
> 
> Thanks
> 
> 
> Run with Hmisc
> 
> mydata <- sas.get(library="F:/sas", mem="formea1",
>              format.library="F:/sas",
>   sasprog = '"C:Program Files/SAS/SAS 9.1/sas.exe"')
>            
> Error in sas.get(library = "F:/sas", mem = "formea1",
> format.library = "F:/sas",  :
>         SAS job failed with status -1
> In addition: Warning message:
> "\"C:Program not found
> 

The warning here is due to wrapping the sasprog argument in single and double 
quotes.  Sometimes you need to do this in R when trying to run a command using 
system() under Windows.  However, sas.get() uses the function shQuote() to wrap 
Windows system calls in double quotes and escapes any internal double quotes 
with "\".  You can see the escape character in the warning message above.  If 
you remove the single quotes the warning should disappear.  

> 
> Run with modified sas.get (Hmisc not loaded)
> 
> Error in sas.get(library = "F:/sas", mem = "formea1",
> format.library = "F:/sas",  :
>         object ".R." not found
> 

Actually, you should load Hmisc using library(Hmisc) and then source in your 
corrected sas.get() function.  Then execute the following call

mydata <- sas.get(library="F:/sas", mem="formea1",
              format.library="F:/sas",
   sasprog = "C:/Program Files/SAS/SAS 9.1/sas.exe") #no single quotes

This assuming that your sas dataset and formats.sas7bcat are in F:\SAS and the 
SAS executable is in the specified directory on the c: drive of the machine you 
are running this on.

Hope this is helpful,

Dan


Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA  98504-5204

______________________________________________
R-help@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.

Reply via email to