Implement BY processing for your entire SAS program
How to write a SAS macro program to repeat your SAS processing for each value of a BY grouping variable.