If you try this approach, you may notice that you should consider changing your original question. You started out asking how to achieve your goal with a minimum number of steps. Instead, consider how to achieve your goal with the fastest-running program. They're not really the same thing. You'll have to learn, if you want to do this. In this case, you'll need to examine the structure of the output data set from PROC SUMMARY. The strategy (using your original variable names) would be to summarize your large data set once, getting counts for each STATE/COUNTY combination. Save the output data set from that summary. Re-summarize it later to get counts for each STATE, or counts for each COUNTY. That way, you end up processing the large data set once, and processing the smaller summary data set multiple times. The program may be longer, but it will run faster if your summary is considerably smaller than the original. If you adopt this approach, you may need to change the statistics you save in the summary data set. If you want to end up with means, you may save the N and SUM statistics in your summary data set. Aggregate those later, and then compute an aggregated mean. In similar fashion, but with a more complex formula, you can save the sum of the squared values in your output data set. The standard deviation can be computed later, using aggregated versions of the sum of squared values, plus the N and SUM statistics. SAS Press publishes a book on efficiency in common programming situations (author is Bob Virgile). Good luck.
... View more