Series J from Box and Jenkins

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

                    SAS Sample Library

        Name: staex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The STATESPACE Procedure
       Title: Series J from Box and Jenkins
     Product: SAS/ETS Software
        Keys: multivariate time series, state space model
        PROC: STATESPACE
       Notes:

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

data seriesj;
   input x y @@;
   label X='Input Gas Rate' Y='Output CO2';
   datalines;
-0.109  53.8  0.000  53.6  0.178  53.5  0.339  53.5
 0.373  53.4  0.441  53.1  0.461  52.7  0.348  52.4
 0.127  52.2 -0.180  52.0 -0.588  52.0 -1.055  52.4
-1.421  53.0 -1.520  54.0 -1.302  54.9 -0.814  56.0
-0.475  56.8 -0.193  56.8  0.088  56.4  0.435  55.7
 0.771  55.0  0.866  54.3  0.875  53.2  0.891  52.3
 0.987  51.6  1.263  51.2  1.775  50.8  1.976  50.5
 1.934  50.0  1.866  49.2  1.832  48.4  1.767  47.9
 1.608  47.6  1.265  47.5  0.790  47.5  0.360  47.6
 0.115  48.1  0.088  49.0  0.331  50.0  0.645  51.1
 0.960  51.8  1.409  51.9  2.670  51.7  2.834  51.2
 2.812  50.0  2.483  48.3  1.929  47.0  1.485  45.8
 1.214  45.6  1.239  46.0  1.608  46.9  1.905  47.8
 2.023  48.2  1.815  48.3  0.535  47.9  0.122  47.2
 0.009  47.2  0.164  48.1  0.671  49.4  1.019  50.6
 1.146  51.5  1.155  51.6  1.112  51.2  1.121  50.5
 1.223  50.1  1.257  49.8  1.157  49.6  0.913  49.4
 0.620  49.3  0.255  49.2 -0.280  49.3 -1.080  49.7
-1.551  50.3 -1.799  51.3 -1.825  52.8 -1.456  54.4
-0.944  56.0 -0.570  56.9 -0.431  57.5 -0.577  57.3
-0.960  56.6 -1.616  56.0 -1.875  55.4 -1.891  55.4
-1.746  56.4 -1.474  57.2 -1.201  58.0 -0.927  58.4
-0.524  58.4  0.040  58.1  0.788  57.7  0.943  57.0
 0.930  56.0  1.006  54.7  1.137  53.2  1.198  52.1
 1.054  51.6  0.595  51.0 -0.080  50.5 -0.314  50.4
-0.288  51.0 -0.153  51.8 -0.109  52.4 -0.187  53.0
-0.255  53.4 -0.229  53.6 -0.007  53.7  0.254  53.8
 0.330  53.8  0.102  53.8 -0.423  53.3 -1.139  53.0
-2.275  52.9 -2.594  53.4 -2.716  54.6 -2.510  56.4
-1.790  58.0 -1.346  59.4 -1.081  60.2 -0.910  60.0
-0.876  59.4 -0.885  58.4 -0.800  57.6 -0.544  56.9
-0.416  56.4 -0.271  56.0  0.000  55.7  0.403  55.3
 0.841  55.0  1.285  54.4  1.607  53.7  1.746  52.8
 1.683  51.6  1.485  50.6  0.993  49.4  0.648  48.8
 0.577  48.5  0.577  48.7  0.632  49.2  0.747  49.8
 0.900  50.4  0.993  50.7  0.968  50.9  0.790  50.7
 0.399  50.5 -0.161  50.4 -0.553  50.2 -0.603  50.4
-0.424  51.2 -0.194  52.3 -0.049  53.2  0.060  53.9
 0.161  54.1  0.301  54.0  0.517  53.6  0.566  53.2
 0.560  53.0  0.573  52.8  0.592  52.3  0.671  51.9
 0.933  51.6  1.337  51.6  1.460  51.4  1.353  51.2
 0.772  50.7  0.218  50.0 -0.237  49.4 -0.714  49.3
-1.099  49.7 -1.269  50.6 -1.175  51.8 -0.676  53.0
 0.033  54.0  0.556  55.3  0.643  55.9  0.484  55.9
 0.109  54.6 -0.310  53.5 -0.697  52.4 -1.047  52.1
-1.218  52.3 -1.183  53.0 -0.873  53.8 -0.336  54.6
 0.063  55.4  0.084  55.9  0.000  55.9  0.001  55.2
 0.209  54.4  0.556  53.7  0.782  53.6  0.858  53.6
 0.918  53.2  0.862  52.5  0.416  52.0 -0.336  51.4
-0.959  51.0 -1.813  50.9 -2.378  52.4 -2.499  53.5
-2.473  55.6 -2.330  58.0 -2.053  59.5 -1.739  60.0
-1.261  60.4 -0.569  60.5 -0.137  60.2 -0.024  59.7
-0.050  59.0 -0.135  57.6 -0.276  56.4 -0.534  55.2
-0.871  54.5 -1.243  54.1 -1.439  54.1 -1.422  54.4
-1.175  55.5 -0.813  56.2 -0.634  57.0 -0.582  57.3
-0.625  57.4 -0.713  57.0 -0.848  56.4 -1.039  55.9
-1.346  55.5 -1.628  55.3 -1.619  55.2 -1.149  55.4
-0.488  56.0 -0.160  56.5 -0.007  57.1 -0.092  57.3
-0.620  56.8 -1.086  55.6 -1.525  55.0 -1.858  54.1
-2.029  54.3 -2.024  55.3 -1.961  56.4 -1.952  57.2
-1.794  57.8 -1.302  58.3 -1.030  58.6 -0.918  58.8
-0.798  58.8 -0.867  58.6 -1.047  58.0 -1.123  57.4
-0.876  57.0 -0.395  56.4  0.185  56.3  0.662  56.4
 0.709  56.4  0.605  56.0  0.501  55.2  0.603  54.0
 0.943  53.0  1.223  52.0  1.249  51.6  0.824  51.6
 0.102  51.1  0.025  50.4  0.382  50.0  0.922  50.0
 1.032  52.0  0.866  54.0  0.527  55.1  0.093  54.5
-0.458  52.8 -0.748  51.4 -0.947  50.8 -1.029  51.2
-0.928  52.0 -0.645  52.8 -0.424  53.8 -0.276  54.5
-0.158  54.9 -0.033  54.9  0.102  54.8  0.251  54.4
 0.280  53.7  0.000  53.3 -0.493  52.8 -0.759  52.6
-0.824  52.6 -0.740  53.0 -0.528  54.3 -0.204  56.0
 0.034  57.0  0.204  58.0  0.253  58.6  0.195  58.5
 0.131  58.3  0.017  57.8 -0.182  57.3 -0.262  57.0
;

title1 'Gas Furnace Data';
title2 'Box & Jenkins Series J';
title3 'Automatically Selected Model';

proc statespace data=seriesj cancorr;
   var x y;
run;

title3 'Transfer Function Model';
proc statespace data=seriesj printout=none;
   var x y;
   restrict f(3,2)=0 f(3,4)=0
            g(3,2)=0 g(4,1)=0 g(5,1)=0;
run;