We combine a large number of files at once to make one SAS data file. I'd like to create a reusable generic SAS program that doesn't need to be changed each time we combine a new set of files (or as little as possible) -- (Ie., so it doesn't list the files out individually in the code). (I have some knowledge in general programming but am newish to SAS, so please reply like I don't understand much.) The files for each year have the same variables and structure (.txt w/ comma delimited) including a header. BUT- 1. the files are stored in separate folders (and folders include other .txt files we want to exclude), and 2. the folder and file names change each time we get new sets of data files to reflect the new date. Here is an example of the folders & file names, with "we want" marking those wanted to combine into 1 data set from both folders. (This example is simplified from real situation... more folders and files as well as exceptions aren't always the same from year to year, etc.) Folder name = C:\EIS\EISFall15 ABC_EISFall2015.txt (---we want) BCD_EISFall2015.txt (---we want) CDE_WW_EISFall2015.txt (---we want) CDE_EISFall2015.txt (---want to EXCLUDE) Folder name = C:\EIS\EISSpring16 ABC_EISSpring16.txt (---we want) BCD_EISSpring16.txt (---we want) CDE_WW_EISSpring16.txt (---we want) CDE_EISSpring16.txt (---want to EXCLUDE) Is there a way to use a macro or something which calls a list of file names/locations (like a list for each year saved in different file, not in this generic code) so I would only have to change the name of that file list in the generic file to create files for different years? So something like this: generic code that loops and creates the combine data file... generic code that opens directory fiie C:\EIS\EIS1516.txt [that name would be the only thing that would need to change each year] generic code loops through and combines only the files listed in the directory file to create 1 large data file. generic code saves SAS data file in same location as directory file. Is this possible? Or other thoughts/ideas? Thanks. Becky
... View more