/* Simulate various types of time series data */ data sim; call streaminit(12345); do t=1 to 1000; e = rand("Normal",0,1); u = rand("Normal",0,1); /* Serial autocorrelation, AR(1) */ if t=1 then do; e = u; * Autocorrelation structure ; y = 1 + e; * Generate data ; end; else do; e = 0.9*e_l + u; * Autocorrelation structure ; y = 1 + e; * Generate data ; end; output; /* Generate lagged values of errors */ e_l = e; end; label y = "Autocorrelated data" t = "Time"; run; proc sgplot data=sim noautolegend; series x=t y=y ; loess x=t y=y / smooth=0.25 lineattrs=(color=red thickness=4); run; /* Statistical properties */ proc corr data=sim cov; var e e_l; run;