Examples Using Remote Library Services (RLS) |
Purpose |
If the amount of data that is needed for a processing job is small, RLS is an efficient way to gather current data that is on a server for client processing and display. This program subsets the data on the server so that only the data you need is transferred. This method saves computing resources on the server and reduces network traffic while it gives you access to the most current data.
In this example, a large reservations database is located on a server that runs under the UNIX operating environment. Several client 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 client session to define the server library that contains the data set RESERVC. The PROC SORT statement sorts the server data set and writes the subset data to the client 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 the client session for processing. Only the data that meets the WHERE= and KEEP= criteria is moved across the network to the client session.
PROC SORT creates the subset data set in the client session and allows all subsequent processing to run in the client session without additional server CPU consumption. PROC SUMMARY and PROC REPORT summarize and format the client data. ODS is used to create an HTML file.
Program |
1 signon srv1; 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 ods html body="body.htm"; 5 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; ods html close;
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.