|
|
|
||||
|
|
|||||
The macro below shows how you can compute a "rolling" standard deviation. For example, it gets the standard deviation for observations 1-25, then observations 2-26 then 3-27 ... up to 476-500, and then saves this into a SAS data file.
%macro rollsd;
proc delete data=all;
run;
%do firstobs = 1 %to 476;
%let lastobs = %eval( &firstobs + 24);
proc means data=test(firstobs=&firstobs obs=&lastobs);
var x;
output out=tempfile stddev=sd25;
run;
proc append base=all data=tempfile ;
run;
%end;
%mend rollsd;
UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services