BookmarkSubscribeRSS Feed
blackraven
Fluorite | Level 6

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?

.

5 REPLIES 5
Quentin
Super User

Hi,

Suggest you try system option NOXWAIT.

HTH,

--Q.

blackraven
Fluorite | Level 6

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.

suraestar
Calcite | Level 5

Hi,

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

KarlK
Fluorite | Level 6

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

blackraven
Fluorite | Level 6

This was very helpful.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1878 views
  • 0 likes
  • 4 in conversation