Date: Wed, 5 Mar 2003 09:45:02 +0100
Reply-To: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject: Re: X command
Content-Type: text/plain; charset="iso-8859-1"
Hi Matthias,
You are quite right. I tested and verified it with SAS vs. 6.12 (on W2K) and
assumed it would work in 8.2 as well, but indeed, it doesn't! I consider
this a serious incompatibility between both versions.
What you could alternatively do is creating a DOS batch file with the
desired DOS command (even from SAS) and run that batch file from SAS. It
forces a copy of the command interpreter (either COMMAND.COM or CMD.EXE) to
be loaded before the command is executed.
Instead you could als explicitly force a copy of the command interpreter
from SAS in the desired DOS command, like (all tested and verified with SAS
8.2):
options noxwait;
%sysexec command /c find /n /i "error" d:\temp.log >> D:\error.txt;
---or---
%sysexec cmd /c find /n /i "error" d:\temp.log >> D:\error.txt;
---or---
options noxwait;
x 'command /c find /n /i "example" d:/sas-test/quotes.log >>
D:/sas-test/x.txt' ;
---or---
x 'cmd /c find /n /i "example" d:/sas-test/quotes.log >> D:/sas-test/x.txt'
;
---or---
options noxwait;
data _null_;
call system ('command /c find /n /i "example" d:/sas-test/quotes.log >>
D:/sas-test/x.txt');
run;
---or---
data _null_;
call system ('cmd /c find /n /i "example" d:/sas-test/quotes.log >>
D:/sas-test/x.txt');
run;
With COMMAND.COM the OPTIONS NOXWAIT appears necessary, but not with
CMD.EXE.
Try these and tell me whether this works in WXP as well.
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statist./data man. P.O. Box 1 fax. +31 412 407 080
J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com
IF Annoying=T THEN Salutation=''; ELSE IF Sex='M' THEN Salutation='Hi'; ELSE
IF Sex='F' THEN Salutation='Dear'; ELSE /* unknown, more, all */
Salutation='Hallo';
Notice of confidentiality: this e-mail may contain confidential information
intended for the addressed recipient only.
If you have received this e-mail in error please delete this e-mail and
please notify the sender so that proper delivery can be arranged.
-----Original Message-----
From: Oeufinc [mailto:oeufinc@yahoo.com]
Sent: 04 March 2003 18:30
To: Jim Groeneveld
Subject: RE: X command
Hi Jim
First at all thanks a lot.
I am running win xp on sas 8.2 and on my machine it does not work although
I used your code.
options noxwait;
%sysexec find /n /i "error" d:\temp.log >> D:\error.txt;
Am I missing something
Regards
Matthias
Jim Groeneveld <J.Groeneveld@ITGroups.com> wrote:
Hi Matthias,
Initially I thought it was due to the slashes as dir separators, which
should be backslashes.
But I found out slashes work as good or as bad as backslashes.
Apparently you can't do redirection from an X command or CALL SYSTEM
statement.
I have not found any reference to that.
But from the macro statement %SYSEXEC (withou surrounding quotes) it works:
options noxwait;
%sysexec find /n /i "example" d:/sas-test/quotes.log >> D:/sas-test/x.txt;
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statist./data man. P.O. Box 1 fax. +31 412 407 080
J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com
IF Annoying=T THEN Salutation=''; ELSE IF Sex='M' THEN Salutation='Hi'; ELSE
IF Sex='F' THEN Salutation='Dear'; ELSE /* unknown, more, all */
Salutation='Hallo';
Notice of confidentiality: this e-mail may contain confidential information
intended for the addressed recipient only.
If you have received this e-mail in error please delete this e-mail and
please notify the sender so that proper delivery can be arranged.
> -----Original Message-----
> From: Oeufinc [mailto:oeufinc@YAHOO.COM]
> Sent: 04 March 2003 00:09
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: X command
>
>
> Hi everybody
>
> IS there a solution to that problem in SAS?
>
> IN DOS it works fine but SAS does not like it.
>
> x 'find /n /i "error" d:/temp_log.log >> D:/error.txt' ;
>
> Thanks
>
> Matthias
>