Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

Example 6. Compute Services: Using MP CONNECT for Multi-Processing


Purpose

To perform two encapsulated tasks in parallel and to wait for the completion of both tasks before continuing the local SAS session execution.


Program

This example sorts two data sets asynchronously. After both sorts complete, the results are merged together.

/* Global SAS system option SASCMD starts an MP CONNECT remote session. */
option sascmd="sas";

/* Remote submit first task. */
rsubmit process=task1 wait=no; 
libname mydata '/project/test1';

   /* Sort the first data set as one task. */
   /* SIGNON performed automatically by RSUBMIT. */
   proc sort data=mydata.part1;
     by x;
run;
endrsubmit;

/* Remote submit second task. */
/* SIGNON performed automatically by RSUBMIT. */ 
rsubmit process=task2 wait=no;
libname mydata '/project/test2';

   /* Sort the second data set as one task. */
   proc sort data=mydata.part2;
     by x;
run;
endrsubmit; 

/* Wait for both tasks to complete. */
waitfor _all_ task1 task2;

*/ Merge the results and continue processing. */
libname mydata '/project/test2';
data work.sorted;
  merge mydata.part1 mydata.part2;
run;


Chapter Contents

Previous

Next

Top of Page

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