The HPREDUCE Procedure

Example 9.4 Output an ODS Table as A Local Data File

The ODS output of PROC HPREDUCE can be stored in a local data file. The following example shows how the "Iteration History" table can be stored as a local file named IterHist by using the ODS output statement:

 data one;
   array x{10};
   array c{10};
   do i=1 to 2000;
     do j=1 to 10;
        x{j}=ranuni(1);
        c{j}=int(ranuni(1)*4);
     end;

 	   if c{1} eq 0 Then b1 = 'aa';
 	   if c{1} eq 1 Then b1 = 'bb';
 	   if c{1} eq 2 then b1 = 'cc';
 	   if c{1} eq 3 then b1 = 'dd';
 	   if c{1} eq 4 then b1 = 'ee';

 	   if c{2} eq 0 Then b2 = 'ff';
 	   if c{2} eq 1 Then b2 = 'gg';
 	   if c{2} eq 2 then b2 = 'hh';
 	   if c{2} eq 3 then b2 = 'ii';
 	   if c{2} eq 4 then b2 = 'jj';

 	   if c{3} eq 0 Then b3 = 'kk';
 	   if c{3} eq 1 Then b3 = 'll';
 	   if c{3} eq 2 then b3 = 'mm';
 	   if c{3} eq 3 then b3 = 'nn';
 	   if c{3} eq 4 then b3 = 'oo';
     output;
   end;
 run;

 proc hpreduce data=one;
     ods output SelectionSummary=Summary;
     class b1-b3 c1-c3;
     reduce  unsupervised b1 b1*b2 b3 c1-c3 x1-x10 /maxsteps =5;
     performance details;
 run;
Last updated: May 25, 2022