Hi Sarah, Just a couple additional notes to what's been said:
1) It seems like R CMD BATCH might be easier 2) If the space in Program Files is causing issues, you can use the Windows environment variable %PROGRAMFILES% (which also means you do not need the drive letter. 3) I find it handy to define a new Windows environment variable with the path to R, then I can just reference that rather than the entire path (a google search will show you lots of ways to do this via the GUI and the command prompt). For instance: "%R%/Rterm.exe" starts R in the command prompt for me. Here is an example run from the Windows command prompt: "%PROGRAMFILES%/R/R-2.11.1/bin/R.exe" CMD BATCH "C:/myscript.R" "C:/results.txt" Cheers, Josh On Wed, Sep 15, 2010 at 10:44 AM, Sarah Jilani <sarahjil...@gmail.com> wrote: > Hi, > > I need to call an R program from Sas. I have tried using the following code > in Sas using the x command but it just calls up dos and says > 'D:\Program' is not recognized as an internal or external command, operable > program or batch file. > ] > SAS CODE: > > options xwait xsync; > > %let Rsource=S:\EPI_Data\Communicable Diseases\DR1355 Historic Communicable > Disease Analaysis\R graphics; > > options xwait xsync; > > x '"D:\Program Files\R\R-2.9.2\bin\Rgui.exe" --no-save --quiet > <""&rsource.\Rtest.R""> ""&rsource.\Rtest.log""'; > > What I need it to do is call R, run an R program and then go back to running > sas. Any ideas on how to do that? > > Thanks! > > Sarah > > -- > --- > Sarah Jilani > (317) 979 2830 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org 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. > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ ______________________________________________ R-help@r-project.org 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.