I find very helpful to use macro in SAS when handling very large dataset, especially when the computing power and memory resources of my laptop are not sufficient. My simple way is to segment large dataset by class of one or more variables, it is like to chop the large one into many small pieces, after operation on each small piece is done, I merge all small pieces back to have the optimized/target dataset for other analysis use.