I've put some SAS programs in a .bat file that runs every day. At the end of the process SAS send me an email with the log file. With which automatic macro variable could I check if there was an error in the execution? In this manner I'd avoid receiving the whole log file.
Wouldn't this just be to collect the highest exit code of the SAS programs you're submitting (as part of the dos script).
As I understand it each of these programs is submitted in batch (within this .bat file). So these are a couple of child processes and there won't be a common SAS macro variable around as every single job runs in its own environment.
Alternatively you could use the Windows Task Scheduler or LSF (if installed at your site) to handle job execution and error conditions.