[R] Calling SAS from R

Guo-Hao Huang guohao.huang at gmail.com
Mon Mar 1 10:10:31 CET 2010


Did you read the help(system)?
You should use ``/'', not ''\'' for you path delimiter in R.

The following is a simple example for opening a pdf reader.
system(paste('"C:/Program Files/Foxit Software/Foxit Reader/Foxit 
Reader.exe"'), wait = FALSE)

It' also easy to modify the example shown in help(system).


with regards
                                                                             
                                                            Guo-Hao Huang

--------------------------------------------------
From: "Yen Lee" <b88207001 at ntu.edu.tw>
Sent: Monday, March 01, 2010 3:42 PM
To: <r-help at stat.math.ethz.ch>
Subject: Re: [R] Calling SAS from R

> Thank you for your reply.
>
>
>
> Because my R program is Chinese version,
>
> I would try my best to translate and specify my question more precisely.
>
>
>
> When I type
>
> system('"c:\\Program Files\\SAS\\SAS
> 9.1\\sas.exe","c:\\entropy\\output7\\scale\\syntax.sas"')
>
> The warning message is as follow,
>
> In system("\"c:\\Program Files\\SAS\\SAS
> 9.1\\sas.exe\",\"c:\\entropy\\output7\\scale\\syntax.sas\"") :
>
>  "c:\Program Files\SAS\SAS
> 9.1\sas.exe","c:\entropy\output7\scale\syntax.sas" is not be found
>
>
>
> When I try
>
> system('"c:\\Program Files\\SAS\\SAS
> 9.1\\sas.exe"','"c:\\entropy\\output7\\scale\\syntax.sas"')
>
> The warring message is as follow,
>
> The mistake is if (intern) flag <- 3L else { : The argument can not be
> interpreted as the logical value.
>
>
>
> These commands also don't work outside R, but I also don't know how to
> modify.
>
>
>
> I guess it's because I lose a command to tell SAS to read the file, but I
> don't know how to do this.
>
>
>
> Hope it's clear enough.
>
> Can anyone give me some help with this?
>
>
>
> Thanks~
>
>
>
> Yen
>
>
>
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] 
> On
> Behalf Of Ben Bolker
> Sent: Monday, March 01, 2010 12:32 AM
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] Calling SAS from R
>
>
>
> Yen Lee <b88207001 <at> ntu.edu.tw> writes:
>
>
>
>> I apologize if my sentence is not fluent to read.
>
>>
>
>> I am doing a simulation study and I need to execute SAS and
>
>> read a SAS code in R.
>
>> I try the following code but it doesn't work.
>
>> system('"c:\\program files\\SAS\\SAS 9.1\\sas.exe" "c:\\syntax.sas"')
>
>> can anyone give me some help with this?
>
>
>
>  You need to tell us, as precisely as possible,
>
> what "doesn't work" means.
>
>  Did R produce warnings or error messages?  What were they?
>
>  If you run the equivalent command (the same except for
>
> single vs double backslashes and surrounding quotation marks)
>
>
>
> "c:\program files\SAS\SAS 9.1\sas.exe" "c:\syntax.sas"
>
>
>
>  outside of R (in a terminal window or from the "Run" box
>
> in Windows), does it work?
>
>
>
> ______________________________________________
>
> R-help at 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.
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list