Sliding Similarity Analysis

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: smyex03.sas
 Description: Example program from SAS/ETS User's Guide,
              The SIMILARITY Procedure
       Title: Sliding Similarity Analysis
     Product: SAS/ETS Software
        Keys: similarity measures, time-stamped data
        PROC: SIMILARITY
       Notes:

--------------------------------------------------------------*/

data workers; set sashelp.workers;
   if '01JAN1978'D <= date < '01JAN1982'D then masonry = masonry;
   else masonry = .;
run;

proc similarity data=workers out=_NULL_ print=(slides summary);
   id date interval=month;
   input  electric;
   target masonry / slide=index measure=msqrdev
                    expand=(localabs=3 globalabs=3)
                    compress=(localabs=3 globalabs=3);
run;

proc similarity data=workers out=_NULL_ print=(slides summary);
   id date interval=month;
   input  electric;
   target masonry / slide=season measure=msqrdev;
run;