I'm trying to monitor the progression of a long SAS script. At the beginning, I used something like:
DATA work.dataset1;
SYSECHO "Currently working on: work.dataset1";
/* DO STUFF*/
END;
PROC SORT DATA=work.dataset1 OUT = work.work.dataset2;
SYSECHO "Currently working on: work.dataset2";
/* DO STUFF*/
END;
.....
DATA work.datasetn;
SYSECHO "Currently working on: work.datasetn";
/* DO STUFF*/
END;
However, this very hard to maintain and very verbose. Hence I tried to create a macro that would automatically get the step name or the step data set (or any information letting me know which step is currently running) and pass it to SYSECHO
:
%macro nstep;
SYSECHO "Finished Processing &SYSLAST";
%mend;
DATA work.dataset1;
%nstep;
/* DO STUFF*/
END;
However, this actually prints the last impacted data set, not the current one. Hence the behaviour is particularly problematic with the first step executed, the first use of %nstep
displays the name of the data set from the previous execution.
I'm searching for a way to find the current data / proc statement name, or any distinctive human readable information.