12-04-2012 01:12 AM
Good Day All,
first simply what i am looking for is a way to execute a static peice of code after every data step / proc step completes.
I do not want to do this
Rather i want to find a way to affect the processing of a data step like you would with application programming, using events.
so i need to find the event that is called just after the data step has finished, a common coded example is:
is there such a way to affect processing?
12-04-2012 04:51 AM
Is there such a way? Not that I knew. (As if that meant a lot ;-) )
However you could create a macro replacement to the RUN and QUIT statement respectively.
Somewhat like this:
%macro static_macro ( called_after = NONE ) ;
%put &sysmacroname called after &called_after ;
%mend static_macro ;
%macro rq (rq_cmd) ;
%local _sp ;
%let _sp = &sysprocname ;
%static_macro ( called_after = &_sp ) ;
%mend rq ;
data _null _ ;
put 'Note: Message from datastep.' ;
%rq ( run ) ;
proc sql noprint ;
select max(age) as max_age from sashelp.class ;
%rq ( quit ) ;
So not an EVENT like solution, much rather a workaround.
BTW: you could get fancier by using automatic macro variable &SYSPROCNAME but I think coding RUN/QUIT as an argument of the RQ macro enhances readability.