BookmarkSubscribeRSS Feed
Onur_Goekcen
Fluorite | Level 6

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!

1 REPLY 1
art297
Opal | Level 21

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 929 views
  • 0 likes
  • 2 in conversation