IMSTAT Procedure (Data and Server Management)

Example 6: Appending Tables

Details

The following example demonstrates using the SET statement to append tables with the active table.

Program

libname example sasiola host="grid001.example.com" port=10010 tag='hps';
libname hdfs sashdat host="grid001.example.com" install="/opt/TKGrid" path="/hps"; 1

proc lasr add data=hdfs.january port=10010; 2
    performance host="grid001.example.com" nodes=all;
run;

proc lasr add data=hdfs.february port=10010;  3
    performance host="grid001.example.com" nodes=all;
run;

data example.march;  4
    set otherlib.march;
run;

proc imstat;
    table example.january; 5
    set february / drop;  6
    set march;  7
run;

   save path="/hps/qtr1" copies=1 replace fullpath;  8
quit;

Program Description

  1. The value for the TAG= option in the SAS LASR Analytic Server LIBNAME statement matches the PATH= value for the SAS Data in HDFS engine LIBNAME statement.
  2. The first table, January, is loaded to memory from HDFS.
  3. The second table, February, is loaded to memory from HDFS. The tables are still independent in-memory tables.
  4. The third table, March, is loaded from another library into the server with the SAS LASR Analytic Server engine.
  5. The first table, January, is set as the active table.
  6. The second table, February, is appended to the active table. The DROP option specifies to remove the February table from memory as soon as the SET statement completes.
  7. The third table, March, is appended to the active table. This table remains in memory.
  8. The February and March tables are now appended to the active table, January. The SAVE statement saves the table to HDFS with the name Qtr1.