Tri-Annual Nile River Level
/*--------------------------------------------------------------
SAS Sample Library
Name: ssmex17.sas
Description: Example program from SAS/ETS User's Guide,
The SSM Procedure
Title: Tri-Annual Nile River Level
Product: SAS/ETS Software
Keys: Temporal Aggregation
PROC: SSM
Notes:
--------------------------------------------------------------*/
data Nile;
input level @@;
year = intnx( 'year', '1jan1871'd, _n_-1 );
format year year4.;
startAggr = (mod(_n_, 3) = 1);
datalines;
1120 1160 963 1210 1160 1160 813 1230 1370 1140
995 935 1110 994 1020 960 1180 799 958 1140
1100 1210 1150 1250 1260 1220 1030 1100 774 840
874 694 940 833 701 916 692 1020 1050 969
831 726 456 824 702 1120 1100 832 764 821
768 845 864 862 698 845 744 796 1040 759
781 865 845 944 984 897 822 1010 771 676
649 846 812 742 801 1040 860 874 848 890
744 749 838 1050 918 986 797 923 975 815
1020 906 901 1170 912 746 919 718 714 740
. . . . . . .
;
title;
proc ssm data=Nile;
ods output AggregateResponse=nileAggr;
id year interval=year;
shift1899 = ( year >= '1jan1899'd );
trend rw(rw);
irregular wn;
model level = shift1899 RW wn / aggregate(start=startAggr);
output out=nileOut;
quit;
proc print data=nileAggr(drop=group obs) noobs;
where year(Time) >= 1967;
run;
proc ssm data=Nile;
id year interval=year;
shift1899 = ( year >= '1jan1899'd );
trend rw(rw);
irregular wn;
model level = shift1899 RW wn / aggregate(start=startAggr);
output out=nileOut;
quit;