You specify one bin size and start and end values, and the output is grouped for each values of grouping variable (cyl).
Input
- InputTable: cars_hist, as in Histogram Example: AutoBin ('Sturges')
SQL Call
DROP TABLE cars_hist_out;
SELECT * FROM Histogram( ON cars_hist AS InputTable OUT TABLE OutputTable(cars_hist_out) USING StartValue(20) BinSize(50) EndValue(400) Inclusion('right') TargetColumn('hp') GroupbyColumns('cyl') ) AS dt;
Output
output_table output_columns --------------------------------- ------------------------------------------------- specified in OutputTable argument "cyl" bin bin_start bin_end bin_count bin_percent
SELECT * FROM cars_hist_out order by 1,2;
cyl bin bin_start bin_end bin_count bin_percent --- --- --------- ------- --------- ----------- 4 0 20.0 70.0 5 45.45 4 1 70.0 120.0 6 54.55 4 2 120.0 170.0 0 0 4 3 170.0 220.0 0 0 4 4 220.0 270.0 0 0 4 5 270.0 320.0 0 0 4 6 320.0 370.0 0 0 4 7 370.0 400.0 0 0 6 0 20.0 70.0 0 0 6 1 70.0 120.0 4 57.14 6 2 120.0 170.0 2 28.57 6 3 170.0 220.0 1 14.29 6 4 220.0 270.0 0 0 6 5 270.0 320.0 0 0 6 6 320.0 370.0 0 0 6 7 370.0 400.0 0 0 8 0 20.0 70.0 0 0 8 1 70.0 120.0 0 0 8 2 120.0 170.0 2 14.29 8 3 170.0 220.0 7 50 8 4 220.0 270.0 4 28.57 8 5 270.0 320.0 0 0 8 6 320.0 370.0 1 7.14 8 7 370.0 400.0 0 0
Download a zip file of all examples and a SQL script file that creates their input tables.