- data c;
- retain avg;
- set a;
- array v v1-v5;
- avg=0;
- sum=0;
- stt=input(compress(d1,,'dk'),8.);
- end=input(compress(d2,,'dk'),8.);
- do i=1 to 2*(end-stt+1) by 1;
- if i<=end-stt+1 then do;
- sum+v[stt-1+i];
- if i=end-stt+1 then do;
- avg=sum/(end-stt+1);
- sum=0;
- end;
- end;
- else if i>end-stt+1 then do;
- sum+(v[stt-1+i-(end-stt+1)]-avg)**2;
- if i=2*(end-stt+1) then std=(sum/(end-stt))**(1/2);
- end;
- end;
- drop sum avg i stt end;
- run;