|
IOM Direct Interface Stored Processes
Creating a Stored ProcessA SAS language stored process is a normal SAS program with an additional feature that enables you to customize its execution. This feature enables the invoking application to supply name/value parameters at the time that the stored process is invoked. For example, if you have a stored process that analyzes monthly sales data, you could create a MONTH variable in the stored process. Then at execution time, to analyze the May sales data, you would supply a name/value pair of MONTH=MAY. The following is an example of a stored process: %let tempdir = ; %let source = ; %let intable = ; %let svar = ; %let filter = ; %let outtitle = ; *ProcessBody; libname datain "&source"; proc sql; create table xQuery as select product, &svar from datain.&intable where &filter; proc sort data=xQuery; by &svar; proc print data=xQuery; by &svar; filename outgif "c:\Temp\&tempdir\xQuery.gif"; goptions reset=all; goptions device=gif gsfname=outgif gsfmode=replace; title1 f=swiss &outtitle; proc gchart data=xQuery; hbar3d product/sumvar=&svar patternid=midpoint; run; As you can see in the example above, SAS Macro Language variables
implement the stored process's execution parameters within the source
body. The macro variables are initialized to default values in the
prologue section of the stored process. The
The remainder of the stored process is an ordinary SAS program--in this case, a general purpose analysis routine that both prints the results and graphs them in a three-dimensional horizontal bar chart. When the stored process is executed, the IOM StoredProcessService applies the client-provided name/value parameters that override the default values of the macro variables. |