Monthly Archives: June 2012

Scheduling jobs in SAS

With SAS, I see SAS DI Studio being more and more employed to write data loading jobs. It is understandable to see this development. Within a data warehouse environment we encounter similar procedures, like reading from a file, adding technical keys, combining tables etc, that could be created with the help of pre-built stones.
When such a data loading jobs is written interactively, one could generate the code and create a job that uses this generated code. Such a job looks like: “C:\SAS\DIserver\Lev1\SASMeta\BatchServer\sasbatch.bat -log C:\SAS\DIserver\Lev1\SASMeta\BatchServer\Logs\Flow_Laad_Orders_#Y.#m.#d_#H.#M.#s.log -batch -noterminal -logparm “rollover=session” -sysin C:\SAS\DIserver\Lev1\SASMeta\SASEnvironment\SASCode\Jobs\Laad_Orders.sas” with Laad_Orders.sas being the generated code.

So far, so good.

However, the generated code seems to use some macros and macro-variables that are not defined. They are only defined in the interactive SAS DI Studio. It is unfortunate but we need to use a work-around. Even worse, the work-around as provided by the SAS-Institute does not work. We may solve this issue by adding a few lines on top of the generated code to create the definition for the omitted macr vars and macros. This code seems to work:

%global job_rc trans_rc sqlrc;
%let sysrc = 0;
%let job_rc = 0;
%let trans_rc = 0;
%let sqlrc = 0;

%macro perfstrt(txnname,metrNam6,METRDEF6);
%mend;
%macro perfstop(metrVal6);
%mend;
%macro perfend;
%mend;
%macro perfinit(applname);
%mend;

Hum, hum, SAS needs to do some extra homework. Hope it is solved in next release,