DATA Step, Macro, Functions and more

Executing external files in a row

Reply
Occasional Contributor
Posts: 7

Executing external files in a row

Hi,

hope that i can finally find an explanation for the weird processing in my macro.

I'm executing some SAS codes externally, which do some highly complex calculations and reporting, etc.. If this external file finishes without any errors, then everything is fine and working. But as soon as an Error occures, the main code executing this external files starts acting really weird, e.g existing and populated datasets return zero rows..

Below is a sample describing the processing:

macro main

  %do loop  (here i execute several sasfiles in a row)

     %executesas(filename=xx,dir=xx)

  %end

  %somemacro

mend

%macro executesas(filename=,dir=)

    %include sasfile....

%mend

%macro somemacro;

   proc sql;

       select count(1) into :var1 from dataset;     --> Here i receive the notification, that no rows were selected?? This happens only if the included sasfile is finished with errors...

   quit;

%mend

 

Appriciate your help!

PROC Star
Posts: 7,363

Executing external files in a row

I think that you would have to provide more of your code for anyone to "see" what you are doing wrong.  Without that, one can only guess.  My first guess, given the sketchy pseudo code that you provided, is that you are defaulting the assignments of filename and dir in your main macro, and the defaulted files aren't applicable when an error occurs during the process.

Ask a Question
Discussion stats
  • 1 reply
  • 122 views
  • 0 likes
  • 2 in conversation