Example 9: Using Server Software from a Client Session

Purpose

Some software might not be available on each computer at your site. In addition, the software that is available on a server might perform some tasks better than the software that is available on your client. From a client session, you can use Compute Services to use software that is available on a server.
This program assumes that SAS/STAT is licensed only on the server. The program uses SAS/STAT to execute statistical procedures on the server.

Program: SAS/STAT Software

rsubmit;
      /**************************************/
      /* The output from GLM is returned    */
      /* to the client SAS listing.         */
      /**************************************/
   proc glm data=main.employee 
      outstat=results;
      model sex=income;
   run;
      /**************************************/
      /* Use GLM's output data set RESULTS  */
      /* to create macro variables F_STAT   */
      /* and PROB, which contain the        */
      /* F-statistic PROB>F respectively.   */
      /**************************************/
   data _null_; set results 
      (where=(_type_= 'SS1'));
      call symput('f_stat',f);
      call symput('prob',prob);
   run;

      /**************************************/
      /* Create macro variables that        */
      /* contain the two statistics of      */
      /* interest in the client session.    */
      /**************************************/
   %sysrput f_statistic=&f_stat;
   %sysrput probability=&prob;
endrsubmit;

Purpose

In the following example, because the server session has access to a fast sorting utility, it sorts the data and then transfers the sorted data to the client session.

Program: Sorting

rsubmit;
      /**************************************/
      /* Indicate to the server machine that*/
      /* the HOST sort utility should be    */
      /* used with PROC SORT. Ask SORT to   */
      /* subset out only those observations */
      /* of interest.                       */
      /**************************************/
   options sortpgm=host;
   proc sort data=tsolib.inventory 
      out=out_of_stock;
      where status='Out-of-Stock';
      by orderdt stockid ;
   run;
      /**************************************/
      /* Output results; client will        */
      /* receive the listing from PRINT.    */
      /**************************************/
   title 'Inventory That Is Currently Out-
          of-Stock';
   title2 'by Reorder Date';
   proc print data=out_of_stock;
      by orderdt;
   run;
endrsubmit;