Help using Base SAS procedures

Quit DOS window from SAS

Reply
Contributor
Posts: 36

Quit DOS window from SAS

Hi.

I use the X command in a SAS program to run a DOS program. The program ends its run with a "Press any key to continue", i.e. the program window does not close with the SAS program options noxwait xsync.

Is there a way for SAS to recognize when the DOS program reached "Press any key to continue" and then quit the window?

.

PROC Star
Posts: 1,324

Re: Quit DOS window from SAS

Posted in reply to blackraven

Hi,

Suggest you try system option NOXWAIT.

HTH,

--Q.

Contributor
Posts: 36

Re: Quit DOS window from SAS

Hi.

The program in the DOS window is running and need to be closed upon showing "Press any key to continue" in the DOS window.

Contributor
Posts: 46

Re: Quit DOS window from SAS

Posted in reply to blackraven

Hi,

Try with SYSTASK COMMAND and you can also use option NOXWAIT.

Contributor
Posts: 65

Re: Quit DOS window from SAS

Posted in reply to blackraven

Well this is a little kludgy, but, assuming your program doesn't expect any input from you during execution, you could just pipe it a keystroke right from the X command. E.g., I wrote a batch program (Test.bat) that just echos text to the console and waits for a keystroke.

echo This is a test

pause

Then, the following SAS program runs the batch program but gives it a keystroke when it asks for one (in this case a 'y', but it could be anything).

options noxwait;

x echo y | test.bat;

When run, it echos the text, reads the 'y' from the echo command, terminates and closes the dos window. Obviously, you'd replace "test.bat" with your program name.

HTH

Karl

Contributor
Posts: 36

Re: Quit DOS window from SAS

This was very helpful.

Ask a Question
Discussion stats
  • 5 replies
  • 278 views
  • 0 likes
  • 4 in conversation