Accumulating Transactional Data into Time Series Data
/*--------------------------------------------------------------
SAS Sample Library
Name: smyex01.sas
Description: Example program from SAS/ETS User's Guide,
The SIMILARITY Procedure
Title: Accumulating Transactional Data into Time Series Data
Product: SAS/ETS Software
Keys: similarity measures, time-stamped data
PROC: SIMILARITY
Notes:
--------------------------------------------------------------*/
data retail;
length store $ 10;
format timestamp date.;
array loc[4] $ loc1-loc4 ("Alamance" "Durham" "Orange" "Wake");
array item[8] item1-item8;
keep store timestamp item1-item8;
call streaminit(1);
do i = 1 to 4;
store = loc[i];
timestamp = '1nov1998'd;
do j = 1 to 100;
dt = floor(30*rand('uniform'));
timestamp = intnx('day',timestamp,dt);
do k = 1 to 8;
item[k] = rand('normal');
end;
output;
end;
end;
run;
proc similarity data=work.retail out=mseries;
by store;
id timestamp interval=month
accumulate=median
setmiss=0
start='01jan1998'd
end ='31dec2000'd;
target _NUMERIC_;
run;