DATA Step, Macro, Functions and more

Running all the programs in a directory

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

Running all the programs in a directory

Dear experts,

 

I'd like to run all the programs (110) in a directory on my pc with a single instruction.

How could I do it with %include, or some other code?

The programs have different names and are very long. I'd like not to write them all in the enhanced editor, neither to write all their names...

 

Many thanks to all.

Daniela

 


Accepted Solutions
Solution
‎10-14-2016 10:06 AM
Super User
Posts: 9,671

Re: Running all the programs in a directory

filename x 'c:\temp\*.sas';
%include x/source2;

View solution in original post


All Replies
Super User
Posts: 5,081

Re: Running all the programs in a directory

Do they have to run in a certain order, or will any order be sufficient?

Contributor
Posts: 23

Re: Running all the programs in a directory

...any order is good

Super User
Posts: 10,483

Re: Running all the programs in a directory

[ Edited ]

%include is likely to be your best bet.

 

And you shouldn't have to type anything as any file manager worth it's name should let you copy and paste path and/or file names.

 

An exercise for the interested reader is to use a FILENAME that consistis of and operating system command to pipe the name of the files using something like DIR c:\path\*.SAS to a data step and then use Call Execute to do the include. NOTE: DO not save the resulting program in the same folder as future runs could create multiple references (or use logic to explicitly NOT use that file for the %include).

Super User
Super User
Posts: 7,397

Re: Running all the programs in a directory

Its rarely as simple as pulling in a directory listing and including each file.  What about interdependancies?  How to QC?  Where to send outputs?  How to check inputs etc.

Solution
‎10-14-2016 10:06 AM
Super User
Posts: 9,671

Re: Running all the programs in a directory

filename x 'c:\temp\*.sas';
%include x/source2;
Contributor
Posts: 23

Re: Running all the programs in a directory

Thank you very much,

it worked!

Daniela

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 370 views
  • 1 like
  • 5 in conversation