|
data EMDATA.VIEW_HW2 /
view=EMDATA.VIEW_HW2;
set SAMPSIO.COSMETIC;
run;
data EMPROJ.SMP_VI0G(drop=_I3VWIHO);
retain _I3VWIHO 0;
set SAMPSIO.COSMETIC;
if ranuni(0) < (2000-_I3VWIHO) / (2700-_n_+1) then do;
_I3VWIHO = _I3VWIHO + 1;
output;
end;
run;
data EMDATA.VIEW_HW2 /view=EMDATA.VIEW_HW2;
set SAMPSIO.COSMETIC;
run;
proc sql;
create view EMPROJ.TRA_G2QA as
select * from EMDATA.VIEW_HW2
order by SKU,group,state,MNTH_YR;
run;
quit;
proc sort data=EMDATA.VIEW_HW2 out=EMPROJ.SUB_SZMI;
by MNTH_YR;
run;
data EMPROJ.SUB_SZMI;
set EMPROJ.SUB_SZMI;
by MNTH_YR;
if First.MNTH_YR then output;
run;
/*--- reduce the size of dataset so a huge
dataset isn't downloaded --*/
data EMPROJ.SUB_SZMI;
set EMPROJ.SUB_SZMI(obs=5000);
run;
options notes source;
*;
* Time Series training code;
*;
proc timeseries data=EMPROJ.TRA_G2QA
out =EMPROJ.OUT_YHSU
outtrend =EMPROJ.TRE_J8FY
outseason=EMPROJ.SEA_M78M
seasonality=12
print=(SEASONS TRENDS);
by SKU group state;
season NOBS N NMISS MINIMUM MAXIMUM
RANGE SUM
MEAN STDDEV CSS USS MEDIAN;
trend NOBS N NMISS MINIMUM MAXIMUM
RANGE SUM MEAN
STDDEV CSS USS MEDIAN;
id MNTH_YR
interval=MONTH
accumulate=Total
setmissing=Missing;
var SALES;
run;
data EMDATA.STRNP658;
set EMPROJ.SEA_M78M;
keep season1-season12 SKU
group state;
retain count season1-season12;
if nmiss(count) then do;
count=0;
end;
count=count+1;
array season{12};
do i=1 to 12;
if i=count then do;
if count ne 12 then
season{i}=Sum;
else if count eq 12
then do;
season{i} = Sum;
output;
count=0;
end;
end;
end;
run;
proc sql;
create view EMPROJ.TRA_G2QA as
select *
from EMDATA.VIEW_HW2
order by SKU,group,state,MNTH_YR;
run;
quit;
proc sort data=EMPROJ.SEA_M78M;
by _SEASON_;
run;
proc sort data=EMPROJ.TRE_J8FY;
by MNTH_YR;
run;
|