Resources

SASŪ High-Performance Analytics Samples

The SAS High-Performance Analytics sample programs and install verification tests can be run only after you edit and submit this file. The file contains site-specific information about your environment so that the procedures can run successfully.

Benefits of Distributed and Multithreaded Computing

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: hpseve06.sas
 Description: Example program from SAS High Performance Analytics
              User's Guide, The HPSEVERITY Procedure
       Title: Benefits of Distributed and Multithreaded Computing
     Product: SAS/HPA Software
        Keys: Severity Distribution Modeling
        PROC: HPSEVERITY
       Notes:

--------------------------------------------------------------*/

/*----- Lognormal Model with left-truncation and censoring -----*/
%let nobs = 10000000;
data largedata(keep=y x1-x3 threshold limit
label='Large Lognormal Sample With Censoring, Truncation, and External Effects'
 );
   call streaminit(45678);
   label y='Censored & Truncated Response Affected by Regressors';
   array x{*} x1-x3;
   array b{4} _TEMPORARY_ (1 0.75 -1 0.25);
   Sigma = 0.25;
   do n = 1 to &nobs;
      Mu = b(1); /* log of base value of scale */
      do i = 1 to dim(x);
         x(i) = rand('UNIFORM');
         Mu = Mu + b(i+1) * x(i);
      end;
      y = exp(Mu) * rand('LOGNORMAL')**Sigma;

      /* make about 20% of the observations left-truncated */
      if (rand('UNIFORM') < 0.2) then
         threshold = y * (1 - rand('UNIFORM'));
      else
         threshold = .;

      /* make about 15% of the observations right-censored */
      iscens = (rand('UNIFORM') < 0.15);
      if (iscens) then
         limit = y;
      else
         limit = .;

      output;
   end;
run;

/* Fit all predefined distributions without any multithreading or
   distributed computing */
proc hpseverity data=largedata criterion=aicc initsample(size=20000);
   loss y / lt=threshold rc=limit;
   scalemodel x1-x3;
   dist _predef_;
   performance nthreads=1 bufsize=1000000 details;
run;

/* Fit all predefined distributions with multithreading, but no
   distributed computing */
proc hpseverity data=largedata criterion=aicc initsample(size=20000);
   loss y / lt=threshold rc=limit;
   scalemodel x1-x3;
   dist _predef_;
   performance bufsize=1000000 details;
run;

option set=GRIDHOST      ="&GRIDHOST";
option set=GRIDINSTALLLOC="&GRIDINSTALLLOC";

/* Fit all predefined distributions on 1 grid node without
   any multithreading */
proc hpseverity data=largedata criterion=aicc initsample(size=20000);
   loss y / lt=threshold rc=limit;
   scalemodel x1-x3;
   dist _predef_;
   performance nthreads=1 nodes=1 details;
run;

/* Fit all predefined distributions on 1 grid node with multithreading */
proc hpseverity data=largedata criterion=aicc initsample(size=20000);
   loss y / lt=threshold rc=limit;
   scalemodel x1-x3;
   dist _predef_;
   performance nthreads=24 nodes=1 details;
run;

/* Fit all predefined distributions with distributed computing and
   multithreading within each node */
proc hpseverity data=largedata criterion=aicc initsample(size=20000);
   loss y / lt=threshold rc=limit;
   scalemodel x1-x3;
   dist _predef_;
   performance nthreads=24 nodes=16 details;
run;