The HPBIN Procedure

Example 3.1 Bucket Binning in Single-Machine Mode

This example shows how you can use PROC HPBIN in the Single-machine mode.

The following DATA step creates the SAS data set as the input for the example:

    data ex12;
        length id 8;
        do id=1 to 1000;
            x1 = ranuni(101);
            x2 = 10*ranuni(201);
            x3 = 100*ranuni(301);
            output;
        end;
    run;

The following statements show the basic usage:

 proc hpbin data=ex12 output=out numbin=10 bucket ;
     input x1-x3; 
 run;

 proc print data=out(obs=10); run;

PROC HPBIN generates several ODS tables, which are shown in Output 3.1.1 through Output 3.1.2.

Output 3.1.1: PROC HPBIN Binning Information Display

The HPBIN Procedure

Binning Information
Method Bucket Binning
Number of Bins Specified 10
Number of Variables 3


Output 3.1.2: PROC HPBIN Mapping Table

Mapping
Variable Binned Variable Range Frequency Proportion
x1 BIN_x1 x1 < 0.099925 108 0.10800
    0.099925 <= x1 < 0.199399 94 0.09400
    0.199399 <= x1 < 0.298872 90 0.09000
    0.298872 <= x1 < 0.398345 95 0.09500
    0.398345 <= x1 < 0.497818 90 0.09000
    0.497818 <= x1 < 0.597291 115 0.11500
    0.597291 <= x1 < 0.696764 116 0.11600
    0.696764 <= x1 < 0.796237 105 0.10500
    0.796237 <= x1 < 0.895711 106 0.10600
    0.895711 <= x1 81 0.08100
x2 BIN_x2 x2 < 1.021539 99 0.09900
    1.021539 <= x2 < 2.015407 110 0.11000
    2.015407 <= x2 < 3.009275 99 0.09900
    3.009275 <= x2 < 4.003143 85 0.08500
    4.003143 <= x2 < 4.997011 109 0.10900
    4.997011 <= x2 < 5.990878 98 0.09800
    5.990878 <= x2 < 6.984746 100 0.10000
    6.984746 <= x2 < 7.978614 94 0.09400
    7.978614 <= x2 < 8.972482 112 0.11200
    8.972482 <= x2 94 0.09400
x3 BIN_x3 x3 < 10.173597 97 0.09700
    10.173597 <= x3 < 20.142996 97 0.09700
    20.142996 <= x3 < 30.112396 106 0.10600
    30.112396 <= x3 < 40.081796 94 0.09400
    40.081796 <= x3 < 50.051196 102 0.10200
    50.051196 <= x3 < 60.020596 99 0.09900
    60.020596 <= x3 < 69.989995 107 0.10700
    69.989995 <= x3 < 79.959395 92 0.09200
    79.959395 <= x3 < 89.928795 91 0.09100
    89.928795 <= x3 115 0.11500


In this example, PROC HPBIN also generates the output table. The first 10 observations of the table are shown in Output 3.1.3.

Output 3.1.3: First 10 Observations in the Output Table

Obs BIN_x1 BIN_x2 BIN_x3
1 7 10 4
2 2 1 9
3 9 8 1
4 8 8 10
5 2 8 7
6 1 6 7
7 7 9 6
8 7 5 1
9 1 4 1
10 7 9 1