Hello Statalisters
I am running a loop over several files, like:

Code:
local originals  "/Users/onedrive/stata/files" // Defining the working directory
local files: dir "`originals'" files "group*" // Define local files
local dir1"/Users/onedrive/stata/newfiles"// Working directory for new files

foreach f of local files {
   capture {...
        save `"`dir1'/`f'"', replace
    }    
   if _rc!=0 {
        save `"`dir1'/break`f'"', replace        
    }  
  }
The problem is that when one particular file breaks up, the following files do the same, even tough when I test the do.file individually (outside the loop) they work just fine.
My question is, how to perform a do.file over several files that allows one specific file to break if there is an exception, while keeping the other files running into the loop?

Thank you and regards,
LR

Stata/MP 15.1 for Mac (64-bit Intel)
Revision 03 Feb 2020