Hi,
This is just the kind of requirement the Loop (and possibly Library Contents) transformations are suited to:
- Assuming you're dealing with SAS datasets that have a date/time stamp, you can use Library contents to do a "query" that will return all the datasets in a library that meet a particular pattern. Behind the scenes, this queries the dictionary.tables table.
- If you're dealing with text files instead of SAS datasets, you'll need to do a bit of user written code. For these types of files, you can use a PIPE as part of a fileref, as illustrated below in an example you can adapt
[pre]
filename files pipe 'dir /B \**';
data myFiles;
length fileName $100;
infile files;
input fileName;
put fileName=;
run;
[/pre]
Either of these techniques will produce a work table with a list of tables or files to process. You can pass this table to the Loop transform. The Loop transform accepts parameters in the form of an input table. These parameters can be passed to a parameterized job, which will be called for each row in the parameter table described above.
Since the data structures are the same between all the tables/files, the parameterized job can be written once and then reused for all files. In your case, you would at least parameterize the input file/table. You would do this by defining a parameter in the job. Each parameter results in a macro variable that you can use in your job, which for what you're talking about would be used to parameterize the file name or table name. You would put the macro in the appropriate field of the metadata object:
- The file name section of the External File object
- The table name on the Physical Storage tab for a table
You might also need to parameterize your output - it depends. If you don't need each iteration to run in parallel, you can just append to the output table from the parameterized job. If you want them to run in parallel, you'd need to parameterize the output table to avoid concurrent write errors. The Loop transformation contains options in regard to parallel execution.
Make sense? If not, I can post some more details.
Thanks,
Tim Stearn