The BY statement in a reporting procedure is responsible for grouping the report by the specified columns. One or multiple columns can be in the BY statement. The BY statement can be placed in any order within a PROC step. The BY statement in PROC SORT is responsible for sorting the table.