Help using Base SAS procedures

executing a batch file

Reply
N/A
Posts: 0

executing a batch file

Hi,

How do i code in SAS to execute a batch file?
SAS Super FREQ
Posts: 8,743

Re: executing a batch file

Hi:
Do you mean execute SAS in batch mode or execute a .BAT file???

I'll answer what I do for the 2nd possibility. When I execute a .BAT or .CMD file on Windows. For example, I have a .BAT file (MYCOPYLIST.BAT) that copies a list of files from one folder to a backup folder. I submit code like this in a SAS program:
[pre]
options noxwait noxsync;
x 'c:\temp\mycopylist.bat';
[/pre]

To find out how to execute SAS in batch mode, you have to consult the SAS Companion for your operating system.
cynthia
N/A
Posts: 0

Re: executing a batch file

Cynthia,

Thats exactly what I do with my batch file. I have a prod.bat on windows. I do not want to click it manually. Rather I would like to code a sas program and schedule it so that it can take care of executing the batch file (runprod.bat). Will this code of yours work for me?
SAS Super FREQ
Posts: 8,743

Re: executing a batch file

It depends on whether the X command is allowed (it's not usually allowed for EG, for example.)

I don't use CHRON or a job scheduler. So I assume that if you scheduled the SAS program to run in batch that it would work. But, why not just schedule the .BAT job to run???

You might want to work with Tech Support on this one. Or maybe someone else has experience with batch submitting programs with an X command.

cynthia
Super Contributor
Posts: 394

Re: executing a batch file

You can use the Windows Task Scheduler to schedule batch files. For more information, use Google to search for "windows schedule batch file" (without the quotes) or click Start->Help and Support and then enter Task Scheduler in the search box.
Ask a Question
Discussion stats
  • 4 replies
  • 214 views
  • 0 likes
  • 3 in conversation