![]() PROC EXPAND or DATA step #SASTip Click To Tweet Create an example time seriesīefore you can compute a moving average in SAS, you need data. This article shows how to use the EXPAND procedure in SAS/ETS software to compute a simple moving average, a weighted moving average, and an exponentially weighted moving average in SAS.įor an overview of PROC EXPAND and its many capabilities, I recommend reading the short paper "Stupid Human Tricks with PROC EXPAND" by David Cassell (2010).īecause not every SAS customer has a license for SAS/ETS software, there are links at the end of this article that show how to compute a simple moving average in SAS by using the DATA step.Ĭompute a moving average in #SAS. (When computing the weighted moving average at time t, the value y t has weight 5, the value y t-1 has weight 4, the value y t-2 has weight 3, and so forth.) The "EWMA" curve is an exponentially weighted moving average with smoothing factor α = 0.3. The "WMA" curve is a weighted moving average with weights 1 through 5. The "MA" curve is a five-point (trailing) moving average. ![]() The graph is a scatter plot of the monthly closing price for IBM stock over a 20-year period. In a previous post, I explained how to define a moving average and provided an example, which is shown here. This article shows how to use PROC EXPAND and contains links to articles that use the DATA step or macros to compute moving averages in SAS. A common question on SAS discussion forums is how to compute a moving average in SAS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |