简体   繁体   中英

How to set rolling window to calculate centered moving average in SAS?

I need to work out the rolling average over window (-30, 30) .

I know that syntax for moving average is something like:

proc expand data = try out = ma;
  convert number = av_number / transformout=( movave 30 );
run;

But this only includes the window (-30, 0)

Can someone tell me the syntax to work out the average for (-30, 30) ?

You're constructing a Centered Moving Average , which is created with the CMOVAVE feature (see the documentation ):

convert number=av_number/transformout=(cmovave 61);

61 would be 30 before, itself, and 30 after.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM