简体   繁体   中英

Importing Flat file dynamically using %MACRO and dataset values SAS

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?

查看调用执行以从数据步骤执行宏。

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM