0
votes

I have a folder with various flat files. There will be new files added every month and I need to import this raw data using an automated job. I have managed everything except for the final little piece.

Here's my logic: 1) I Scan the folder and get all the file names that fit a certain description 2) I store all these file names and Routes in a Dataset 3) A macro has been created to check whether the file has been imported already. If it has, nothing will happen. If it has not yet been imported, it will be imported.

The final part that I need to get right, is I need to loop through all the records in the dataset created in step 2 and execute the macro from step 3 against all file names.

What is the best way to do this?

2
Look into call execute for executing a macro from a data step.Reeza
@Reeza, Can you please add this as an answer and I'll mark it as the accepted answer. Thank you very much.HermannHH

2 Answers

1
votes

Look into call execute for executing a macro from a data step.

0
votes

The method I most often use, is to write the macro statements to a file and use %include to submit it. I guess call execute as Reeza suggested is better, but I feel more in control when I do it like this:

filename s temp;
data _null_;
    set table;
    file s;
    put '%macrocall(' variable ');';
run;
%inc s;