BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

How do i code in SAS to execute a batch file?
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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?
Cynthia_sas
SAS Super FREQ
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
Tim_SAS
Barite | Level 11
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3661 views
  • 1 like
  • 3 in conversation