Re: [R] Call SAS from R

From: Nordlund, Dan <NordlDJ_at_dshs.wa.gov>
Date: Thu 25 Aug 2005 - 03:38:17 EST


David,

  1. I assume you are working on a MS Windows OS given your system command.
  2. You need to determine what command will work to run your program from the command line in Windows. If your path is correct, then you can run SAS from the command line like
      "c:\program files\sas institute\v8\sas.exe" test
      

Notice, the quotes do not include your SAS input file. Also, you only use single back-slashes on the command line. If the above works for the Windows command line, then go to 3.

3. The R command should then look like the following.

     System('"c:\\program files\\sas institute\\v8\\sas.exe" test')

Notice that in R I have escaped the back-slashes, and have placed the whole command in single quotes. This ensures that the double quotes are passed on to Windows.

Hope this helps,

Dan

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

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Shin, David Sent: Wednesday, August 24, 2005 9:50 AM To: 'Don MacQueen'; r-help@stat.math.ethz.ch; bioconductor@stat.math.ethz.ch Subject: Re: [R] Call SAS from R

Thanks for the responses.
Here is the command I used and the error message I got.

> system("c:\\program files\\sas institute\\v8\\sas.exe test")
Warning message:
c:\program not found

if I change "program files" to "progra~1" then the output is:
> system("c:\\progra~1\\sas institute\\v8\\sas.exe test")
Warning message:
c:\progra~1\sas not found

I don't know how to change the folder name "sas institute" to let R reads it. Can someone help me with this?

The strange thing is that if I type in the command "c:\\progra~1\\sas institute\\v8\\sas.exe test" in dos environment, it didn't work, either.

I will appreciate very much if someone can help a bit. Thanks.

David



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 Received on Thu Aug 25 03:43:55 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:50:24 EST