As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Tips:Summarize data in a rolling window

From sasCommunity
Jump to: navigation, search

Obtaining summary statistics over a rolling window for a given data, usually on a time dimension, is not very easy in SAS, especially if the rolling window may contain a different number of records and the maximum number is unknown without passing the data once. For example, given transaction data over several days, a business analyst may want to summarize the data for each 24 hour period. This is actually a recent question on SAS-L.

There are several approaches. Typically, people use an array that is large enough to handle a reasonable guess of maximum number of records within the given interval. Or they use a hash table so as to manage the data cells dynamically. The coder basically needs to build a stack which is first-in, first-out. Both of these methods are not easy to code and are error-prone for a beginner.

This rolling window problem can be efficiently solved by using MultiLabel Format, a feature tending to be ignored. Check the see also link for details.

Submitted by Liang Xie. Contact me at my Discussion Page.

....see also