I have around 60 programs which would creating listings for different scenarios.....Every week i have run them....so i have to call them individually....... I am just wondering if there is any option where we can save all those programs in a folder and write a program to call all those program located in that particular folder instead of running them individually........
If you need them to run in a specific order then use of %Include is probably the way to go.
Create a SAS program that looks something like;
If you have a long path it may be easier to have a macro variable hold it
%let folder = C:\folder\anotherfolder\program folder;
You could use a OS shell script as Tom suggests, or %include (but this executes everything as a single program), or MP connect.
Systask would be another option 6814 - Example of SYSTASK COMMAND statement to start a SAS batch job within aSAS program as it allows you to run programs independently, in sequence or in parallel (in combination with the "waitfor" statement) like you could do with a shell script - but you can code everything in SAS which is may be syntax you're more familiar with.
You are describing a scheduling facility, if you have no scheduler there are ways to simulate that.
The best thing is when they are all independent, no ordering just a start program.
Do not use the %include but run it as MP-Connect, SAS-connecte licensed? or batch schript, (X-cmd open?
Reading the filenames in a directory is an easy part. Using Dopen dinfo will make it machine independent
If you have a script every week running eg 03:00u am monday. (cron or whatever) you can read those names and start those.
What to do with the logging? results? returncode?
You might be best to create an operating system command to do this. For example in ksh on Unix you would just use this simple one line program.
for x in $(ls *.sas) ; do sas $x ; done
Of course if you want to check if the individual jobs completed correctly or other conditional processing decisions the task would get harder. If you have a scheduling tool then perhaps you might want to use that.
You could write a SAS program. If you don't care if the programs run in a separate session you can just %INCLUDE all of them.
But that is a big IF because there can be serious side effects from running multiple independent programs in a single session.
If you have access to X commands then you can have SAS do what the FOR loop in KSH above was doing.
infile "ls *.sas" pipe truncover ;
input program $256.;
infile execute pipe filevar=command end=eof ;
do while (not eof);
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.