Previous Page | Next Page

Examples of Combining Compute Services and Data Transfer Services

Example 1. Compute Services and Data Transfer Services Combined: Processing in the Client and Server Sessions


Purpose

The SAS/CONNECT statements SIGNON, SIGNOFF, RSUBMIT, and ENDRSUBMIT enable you to submit statements from a client session to a server session. You can include these statements in a SAS program and do both client and server processing within a single SAS program. This program can be run in an interactive line mode SAS session, in a non-interactive SAS session, or by including the program in a client session. In each case, the program executes statements in both the client and server sessions.


Program

This program processes data on a server, downloads the resulting SAS data set, creates a permanent data set in the client session, and prints a report in the client session.

      /*************************************/
      /* prepare to sign on                */
      /*************************************/
1  options 
      comamid=tcp 
      remote=netpc;  
2  libname lhost 'c:\sales\reg1';

      /*************************************/
      /* sign on and download data set     */
      /*************************************/
3  signon;
4  rsubmit;
5     libname rhost 'd:\dept12';
6       proc sort data=rhost.master 
         out=rhost.sales;
         where gross > 5000;
         by lastname dept;
      run;

7     proc download data=rhost.sales 
         out=lhost.sales;
      run;
8  endrsubmit;


9       /*************************************/
      /* print data set in client session  */
      /*************************************/
 proc print data=lhost.sales;
 run;

[1] Specifies the COMAMID= and the REMOTE= system options in an OPTIONS statement. These two system options define the connection between the client and server sessions.

[2] Defines a libref for the SAS library in the client session to identify the location of the data set to be downloaded.

[3] Signs on to the server session. The server-ID was specified in the preceding OPTIONS statement.

Note:   A script file is not used.  [cautionend]

[4] Uses the RSUBMIT and ENDRSUBMIT statements to define statements to send to the server for processing. If the client session is connected to multiple active server sessions, specifying the server ID in the RSUBMIT statement clarifies which server session should process the block of statements. If server-ID is omitted, RSUBMIT directs the statements to the most recently identified server session.

[5] Defines the libref for the SAS library in the server session.

[6] Creates the RHOST.SALES data set as a sorted subset of the RHOST.MASTER data set.

[7] Transfers the SALES data from the library in the server session (RHOST) to the library in the client session (LHOST).

[8] Marks the end of the block of statements to be submitted to the server session. Statements that follow the ENDRSUBMIT statement are processed in the client session.

[9] Reads and prints the SAS data set that was downloaded in the PROC DOWNLOAD step.


Running the Program

You have several choices for running this program:

Previous Page | Next Page | Top of Page