SAS loops automatically so you don't need any loops I suspect.
It also does BY group processing so you can do similar functions across groups of data.
If you're working with time series, you'll want to look at PROC EXPAND to calculate statistics such as moving averages, means or standard deviation. Make sure to find the examples in the documentation that show how these tasks can be accomplished.
... View more