I am looping through folders to -precombine- files in every folder to check for incompatibilities before appending them. I want to precombine every file in each folder except one. The files I want to use do not have consistent file names within or across folders, but the file I want to exclude in each folder ends in "_all.dta". The text before "_all.dta" is not consistent so enumerating the files in a loop and excluding based on that isn't possible. I tried using -if strpos(`"`files'"', "_all") == 0- before the precombine but I realized all that was doing was saying, if there is a file that doesn't contain "_all", precombine all the files, which doesn't help. Is there a straightforward way to exclude the file ending in "_all.dta" from the `files' macro? Or another solution?
Code:
foreach folder of local folder_list { cd "`dta_path'/`folder'" local files: dir "." files "*.dta" precombine `files', uniquevars describe(type ndta) }
Comment