The HPBIN Procedure

Example 3.1 Bucket Binning

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 Figure 3 through Figure 4.

Figure 3: PROC HPBIN Binning Information Display

The HPBIN Procedure

Binning Information
MethodBucket Binning
Number of Bins Specified10
Number of Variables3


Figure 4: PROC HPBIN Mapping Table

Mapping
VariableBinned VariableRangeFrequencyProportion
x1BIN_x1x1 < 0.09992549691080.10800000
  0.0999254969 <= x1 < 0.1993986319940.09400000
  0.1993986319 <= x1 < 0.2988717668900.09000000
  0.2988717668 <= x1 < 0.3983449018950.09500000
  0.3983449018 <= x1 < 0.4978180367900.09000000
  0.4978180367 <= x1 < 0.59729117161150.11500000
  0.5972911716 <= x1 < 0.69676430661160.11600000
  0.6967643066 <= x1 < 0.79623744151050.10500000
  0.7962374415 <= x1 < 0.89571057651060.10600000
  0.8957105765 <= x1810.08100000
x2BIN_x2x2 < 1.0215392099990.09900000
  1.0215392099 <= x2 < 2.01540704261100.11000000
  2.0154070426 <= x2 < 3.0092748753990.09900000
  3.0092748753 <= x2 < 4.003142708850.08500000
  4.003142708 <= x2 < 4.99701054071090.10900000
  4.9970105407 <= x2 < 5.9908783734980.09800000
  5.9908783734 <= x2 < 6.98474620611000.10000000
  6.9847462061 <= x2 < 7.9786140388940.09400000
  7.9786140388 <= x2 < 8.97248187151120.11200000
  8.9724818715 <= x2940.09400000
x3BIN_x3x3 < 10.173596707970.09700000
  10.173596707 <= x3 < 20.14299647970.09700000
  20.14299647 <= x3 < 30.1123962321060.10600000
  30.112396232 <= x3 < 40.081795994940.09400000
  40.081795994 <= x3 < 50.0511957571020.10200000
  50.051195757 <= x3 < 60.020595519990.09900000
  60.020595519 <= x3 < 69.9899952811070.10700000
  69.989995281 <= x3 < 79.959395044920.09200000
  79.959395044 <= x3 < 89.928794806910.09100000
  89.928794806 <= x31150.11500000


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

Figure 5: First 10 Observations in the Output Table

ObsBIN_x1BIN_x2BIN_x3
17104
2219
3981
48810
5287
6167
7796
8751
9141
10791


Last updated: March 06, 2023