Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

Example 1. Compute Services and Data Transfer Services Combined: Local and Remote Processing


Purpose

The SAS/CONNECT statements SIGNON, SIGNOFF, RSUBMIT, and ENDRSUBMIT enable you to submit statements to a remote host from a session on the local host. You can include these statements in a SAS program and do both local and remote 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 session that is running on your local host. In each case, the program executes statements on both the local host and the remote host.


Program

For example, suppose that you want to perform some processing on a remote host, download the resulting SAS data set, create a permanent data set on the local host, and print a report on the local host.

The following example illustrates how to put all of these tasks into a single program.

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

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

[6]    proc download data=rhost.sales 
         out=lhost.sales;
      run;
[7] endrsubmit;

[8]
      /*************************************/
      /* print data set in local session   */
      /*************************************/
 proc print data=lhost.sales;
 run;
[1] Specify the COMAMID= and the REMOTE= system options in an OPTIONS statement. These two system options define to the local session what type of link you want to establish to which remote host.
[2] Define a libref for the SAS data library on the local session where the downloaded data set should be stored.
[3] Sign on to the remote host. It is not necessary to include remote-session-id when you have defined the REMOTE= system option in a previous OPTIONS statement.

Note:   This connection is not using a script file.  [cautionend]

[4] Send statements to the remote session for processing with the RSUBMIT statement. All statements are sent to the remote session until an ENDRSUBMIT statement is encountered. Although it is not necessary to include remote-session-id, using remote-session-id in the RSUBMIT statement clarifies which remote session should process a group of statements when more than one link is active. If you omit remote-session-id, the RSUBMIT statement submits the statements to the remote session that is most recently identified in a SIGNON or an RSUBMIT statement or a REMOTE= system option.
[5] Define the libref for the SAS data library on the remote host.
[6] The PROC DOWNLOAD step transfers the data from the library on the remote host (RHOST) to the library on the local host (LHOST).
[7] The ENDRSUBMIT statement signals the end of the block of statements that is to be submitted to the remote session. Statements following the ENDRSUBMIT statement are processed by the local session.
[8] The PROC PRINT step executes in the local session and reads the SAS data set that was downloaded in the PROC DOWNLOAD step.


Running the Program

You have several options for running this program:


Chapter Contents

Previous

Next

Top of Page

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