Example 5. RLS: Updating a Server Data Set by Applying a Client Transaction Data Set

Purpose

In client/server jobs where data must be kept current and the number of updates that you need to perform is small, RLS can be an effective solution. RLS enables you to perform a client update to a server data set.
This example creates a data set by remotely submitting a DATA step. Next, it creates a client transaction data set. Using RLS, it assigns a client libref to the server library. Finally, the program uses the client transactions to modify the server data set.

Program

%let rsession=unxhost;
signon remote=rsession;
   rsubmit;1
    data sasuser.my_budget;
      length category $ 9;
      input category $ balance;
      format balance dollar10.2;
      datalines;
   utilities   500
   mortgage   8000
   telephone  1000
   food       3000
   run;

   endrsubmit;
2
 data bills;
      length category $ 9;
      input category $ bill_amount;
      datalines;
   utilities    45.83
   mortgage    649.95
   food         68.21
   run;
3
 libname rlslib slibref=sasuser server=rsession;
4
 data rlslib.my_budget;
      modify rlslib.my_budget bills;
      by category;
      balance=balance-bill_amount;
   run;
5
 data _null_;
      set rlslib.my_budget;
      put 'Balance for ' category  @25 
         'is: ' balance;
   run;
6
 signoff;
1 Creates the master data set MY_BUDGET in the library SASUSER in the server session.
2 Creates a client transaction data set BILLS for updating the server data set MY_BUDGET.
3 Assigns the client libref RLSLIB to the library SASUSER in the server session.
4 Applies the transaction data set BILLS to the server data set MY_BUDGET.
5 Reviews the results. Three observations are updated.
6 Signs off the server. The libref RLSLIB is deassigned as part of the sign-off processing.