%macro stableband(lag=1,Gtimes=6); data sb; do p = 1 to &lag. + 1; do i = 1 to &Gtimes.; array col[&Gtimes.] col1-col&Gtimes.; do j = 1 to &Gtimes.; parm = p; row = i; if p < &lag. + 1 then do; if (i-j) = p-1 then col[j] = 1; else col[j]=0; end; else do; if j <= i - &lag. then col[j] = 1; else col[j]=0; end; end; output; end; end; drop j i p; run; %mend;