BookmarkSubscribeRSS Feed
dgoel
Fluorite | Level 6

I have this currently:

 

%Macro checksourcetable;

  %IsReadyToRun (%str(&PROGRAMNAME.), %sysfunc(dequote(&TD_ASOFDT.)));

  %if &rl_result_value. eq %str(N) %then

    %do;

%queueprocess(&rl_process_id.,0.5);

%RecordLog(%str(Requeue the process as the input tables have not completely loaded));

     %ProcessFooter;

  %abort cancel;

    %end;

  %else

    %do;

      %put 'Source tables available';   

%RecordLog(%str(All source tables are available.));

    %end;

%Mend checksourcetable;

 

Currently at %abort cancel, it ends abruptly, instead I want it to go out of the macro to the end of the program and end. 

 

How can i change this?

3 REPLIES 3
Astounding
PROC Star

If you don't want to %abort, don't %abort.  Do something else instead.  For example, set a value for a global macro variable.  Then have the next step in the program examine the global macro variable to decide what processing should take place.

dgoel
Fluorite | Level 6

Do you think you can share an example, I am not sure if I understood correctly.

ballardw
Super User

@dgoel wrote:

I have this currently:

 

%Macro checksourcetable;

  %IsReadyToRun (%str(&PROGRAMNAME.), %sysfunc(dequote(&TD_ASOFDT.)));

  %if &rl_result_value. eq %str(N) %then

    %do;

%queueprocess(&rl_process_id.,0.5);

%RecordLog(%str(Requeue the process as the input tables have not completely loaded));

     %ProcessFooter;

  %abort cancel;

    %end;

  %else

    %do;

      %put 'Source tables available';   

%RecordLog(%str(All source tables are available.));

    %end;

%Mend checksourcetable;

 

Currently at %abort cancel, it ends abruptly, instead I want it to go out of the macro to the end of the program and end. 

 

How can i change this?


If you want to skip to the end of the macro Checksourcetable try this:

 

%Macro checksourcetable;
  %IsReadyToRun (%str(&PROGRAMNAME.), %sysfunc(dequote(&TD_ASOFDT.)));
  %if &rl_result_value. eq %str(N) %then
    %do;
%queueprocess(&rl_process_id.,0.5);
%RecordLog(%str(Requeue the process as the input tables have not completely loaded));
     %ProcessFooter;
  %goto eom;
    %end;
  %else
    %do;
      %put 'Source tables available';   
%RecordLog(%str(All source tables are available.));
    %end;
 
%eom: %Mend checksourcetable;

Nothing magic about eom above it is just a label. I used that for "end of macro".

 

Please post code into a code box opened on the forum using the {I} icon to preserve formatting. The message windows will reformat text quite a bit sometimes removing white space or inserting line breaks when copy and pasting to the editor.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 547 views
  • 0 likes
  • 3 in conversation