09-12-2014 09:22 AM
You can do a directory listing and do an execute with an %include of all of them. Possible yes. Does it make sense? hardly.
What problem do you trying to solve? Is it about autocalling macros?
09-12-2014 09:28 AM
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........
09-12-2014 10:55 AM
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;
09-14-2014 12:15 AM
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.
09-12-2014 10:02 AM
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?
09-12-2014 12:39 PM
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);