Example 2. Compute Services and Data Transfer Services Combined: Sorting and Merging Data

Purpose

When multiple client sessions need to access a single data set on the server, Data Transfers Services can be used to distribute the subset of data that is needed by each session. Each client session receives only the data that it needs, and uses Compute Services to process its data in its session. When you use this method, client sessions do not continually access the data set on the server.

Program

This SCL program fragment distributes a data set that contains reservations data from a server that is located at a central office to clients at several franchise offices. The program enables distribution of selected reservations to a franchise office by using a WHERE statement.
   INIT:
   submit continue;
   signon atlanta;

 rsubmit;
      libname mres "d:\counter";
      libname backup "d:\counter\backup";
1
     proc upload data=mres.reserv
          out=combine status=no;
          where origin="Atlanta";
       run;
2
     proc sort data=combine;
          by resnum;
       run;
3
     proc copy in=mres out=backup;
          select reserv;
       run;
4
     data mres.reserv;
          update mres.reserv combine;
          by resnum;
       run;
   endrsubmit;

   signoff;
1 Uploads all reservations for a particular location.
2 Sorts uploaded data sets for merging.
3 Backs up existing data set.
4 Merges new and existing data sets.