10-03-2012 03:11 PM
I have a folder that has multiple text files as below.
I need to read all text files data from the above folder by using macro code instead of infile statement because the files will get updated frequently and create a sas dataset for further analysis.
Please help me how to create a macro to read all txt files data in the sas dataset ?
Thanks for your help.
10-03-2012 04:05 PM
From your explanation I don't see how a macro would be better than a route similar to what Linlin suggested. I do have a couple of questions, though. What will determine if a file should be imported? Do all of the files end up getting appended to one SAS file? Do the files that were already uploaded have to be replaced and/or updated?
10-03-2012 04:10 PM
Yes Arthur, once the file was imported it has to be append into one SAS file.Once in a week the additional files will get uploaded to the production folder, inorder to avoid the programming changes everytime we tried to create a macro that reads a additional and existing file from the folder.
10-04-2012 01:54 AM
Am I missing something or is it as simple as adding a wildcard into the FILENAME statement:
filename intxt "c:\temp\xx*.txt";
input var $;