BY-group processing requires that the BY variables are either sorted in the dataset or indexed. SAS processes observations in groups based on BY variable values, which requires ordered data. The procedure doesn't overwrite the dataset but produces grouped output.