Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

Example 6. RLS: Subsetting Remote Data for Local Processing and Display


Purpose

If the amount of data that is needed for a processing job is small, RLS is an efficient way to gather current data on a remote host for local processing and display. This program subsets the data on the remote host so that only the data you need is transferred. This method saves computing resources on the remote machine and diminishes network traffic while it gives you access to the most current data.

In this example, a large reservations database exists on a remote UNIX platform. Several local procedures need to be run against a small subset of the data that is contained in the master reservations database. This situation is ideal for RLS.

The LIBNAME statement is issued in the local SAS session to define the remote library that contains the data set RESERVC. The PROC SORT statement sorts the remote data set and writes the subset data to the local disk.

The WHERE= and KEEP= options are specified in the PROC SORT statement to reduce the amount of data that moves through the network to local processing. Only the data that meets the WHERE= and KEEP= criteria is moved across the network to the local session.

PROC SORT creates the subset data set on the local machine and allows all subsequent processing to run on the local machine without further remote CPU consumption. PROC SUMMARY and PROC REPORT summarize and format the local data so that it can be displayed to the user by using the NOTEPAD command.


Program

   init:
   submit continue;
[1]  libname remlib '/u/user1/reservations' 
       server=srv1;

[2]  proc sort data=
       remlib.reservc(keep=company origin 
       where=(origin='ATLANTA'))
       out=tmp;
       by company;
    run;

[3]  proc summary data=tmp 
       vardef=n noprint;
       by company;
       output out=tmp2;
    run;

[4]  proc printto new print=work.view.report.source;
    run;

    proc report ls=74 ps=85 split=
    "/" HEADLINE HEADSKIP CENTER NOWD;
    column 
      ("Totals" "" "" "" company _freq_);
    define company / group format=$40. 
       width=40 spacing=2 left "Company";
    define _freq_ / sum width=14 
       spacing=2 right "# Reservations";
    rbreak after /ol dul skip summarize 
       color=cyan;
    run;

    proc  printto print=print;
    run;
 endsubmit;

[5] call execcmdi('notepad work.view.report.source; 
       color back blue;');

    _status_='H';
    return;

    main:
    return;

    term:
    return;
[1] Submit local LIBNAME statement to define the remote library.
[2] PROC SORT runs locally but accesses the remote data set RESERVC. A subset of RESERVC is written to the local data set TMP. The WHERE= and KEEP= options are passed to the server session and evaluated there to minimize the amount of data that must move across the network.
[3] Summarize the local data set.
[4] Create a report using this local, summary data set.
[5] Display the report.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.