04-23-2013 05:03 PM
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?
04-24-2013 11:14 AM
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
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).
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.