DATA Step Programming for Scoring In SAS LASR Analytic Server

Scoring In-Memory Tables Using DATA Step Processing

The DATA step can process in-memory tables for scoring with limitations:
  • Only one input file and one output file is allowed.
  • Only functions and formats that are supported by the DS2 language compile successfully.
  • Some DATA step statements are not allowed, such as those pertaining to input and output.
To enable the DATA step to score in-memory SAS tables, set the system option DSACCEL=ANY.
If a SAS program does not meet the requirements for running in the SAS LASR Analytic Server, SAS writes informational or error messages to the log and executes the code in your Base SAS session. In this case, SAS reads and writes large tables over the network.
You can determine whether your code is compliant with the SAS LASR Analytic Server compiler by setting the system option MSGLEVEL= to I. When MSGLEVEL=I, SAS writes log messages that identify the non-compliant code.

Example 1: A DATA Step Program For SAS LASR Analytic Server

This example demonstrates executing a DATA step program in the SAS LASR Analytic Server:
/* Enable DATA step parallel processing using the system option   */
/* and enable messages to view non-compliant code in the SAS log. */
options dsaccel=any msglevel=i;

/* Create a libref for in-memory tables. */
libname lasr sasiola host="grid001.example.com" port=10010 tag='hps';

/* Create a libref for the input data that is stored on disk. */
libname score '/myScoreData/';

/* Load the input table into memory */
data lasr.intr;
   set score.intrid;
run;

/* Execute the score code using the in-memory tables. */
/* Both tables must use the same libref.              */
data lasr.sumnormtable;
   set lasr.intr;

/* Execute the score code. */
if sum > 1000
  then score=1;

run;

Example 2: Using User-Defined Formats with In-Memory Tables

You can use user-defined formats in a DATA step by using the CATALOG procedure to copy the format catalog to a library. This example copies the format library to Work:
/* Enable DATA step parallel processing using the system option   */
/* and enable messages to view non-compliant code in the SAS log. */

options dsaccel=any msglevel=i;

/* Create a libref for the in-memory tables. */
libname lasr sasiola host="grid001.example.com" port=10010 tag='hps';

/* Create a libref for the input data and format catalog that is  */
/* stored on disk.                                                */
libname score '/myScoreData/';

/* Copy the demx format catalog to the Work library */
proc catalog catalog=score.dmex; 
   copy out=work.formats; 
quit;

/* Enable in-memory processing (dsaccel) and load the input table */
/* into memory.                                                   */
data lasr.dmex;
   set score.dmex;
run;

/*  Enable in-memory processing (dsaccel) and execute the score code .*/
/*  using the in-memory tables.                                       */
data lasr.dmexout;
   set lasr.dmex;
   %inc "dmex.sas";
run;

SAS automatically searches the Work and Library libraries for a format catalog. If you copy the format library to a library other than Work or Library, then you must use the FMTSEARCH= system option to let SAS know the location of the format library.
options fmtsearch=(myFmtLib);
You must also specify the FMTSEARCH= system option if the format catalog name is not format:
options fmtsearch=(myFmtLib.myFmts);

Requirements for LASR Score Mode DATA Step Processing

In order to score in-memory tables in SAS LASR Analytic Server, the following is required:
  • The DSACCEL=ANY system option is set.
  • The code must contain a LIBNAME statement using the SASIOLA engine.
  • The input and output tables must use the same libref for the SASIOLA engine.
  • The DATA statement must be followed immediately by the SET statement.
    This example demonstrates these requirements:
    libname lasr sasiola;
    data lasr.out;
       set lasr.in;
       /* DATA step code */
    run;

Restrictions in DATA Step Processing

Here are the restrictions for using the DATA step in SAS LASR Analytic Server:
  • More than one SET statement is not supported. SET statement options are not allowed.
  • These statements are not supported:
    • BY (or FIRST. and LAST. variables)
    • CONTINUE
    • DISPLAY
    • FILE
    • Sub-setting IF
    • INFILE
    • INPUT
    • LEAVE
    • MERGE
    • MODIFY
    • OUTPUT
    • PUT
    • REMOVE
    • RENAME
    • REPLACE
    • RETAIN
    • UPDATE
    • WHERE
    • WINDOW
  • The ABORT statement has these restrictions:
    • The ABORT statement does not accept arguments.
    • The ABORT statement is not supported within functions. It is valid only in the main program.
  • These functions are not supported:
    • DIF
    • LAG
  • The INPUT function does not support the question mark (?) and double question mark (??) modifiers.
  • Some CALL routines are not supported. Routines are supported if there is an equivalent function.
  • You can use only SAS formats and functions that are supported by the DS2 language. These formats and functions are documented in SAS DS2 Language Reference.
  • Component objects are not supported.
  • Scoring input variables cannot be modified.