How can I get predicted values for new observations in PROC SYSLIN?


If there are no endogenous variables on the right-hand side of the equations, then you can simply append the new observations to your original data set. Any endogenous variables should be set to missing. Then rerun your PROC SYSLIN step including an OUTPUT statement with the PREDICTED= option. Note that all explanatory variables used in the equations must be nonmissing in order to compute a predicted value for a new observation. The SYSLIN procedure will use only the original observations for estimation, not any observations with missing endogenous variables. However, it will provide predictions in the output data set for all observations including the new observations which contain missing endogenous variables.

If there are endogenous variables on the right-hand side of the equations, use PROC SIMLIN after your PROC SYSLIN step to obtain predicted values. The EST= option in the PROC SIMLIN statement reads the coefficients produced by the OUTEST= option in the previous PROC SYSLIN step and computes the reduced form of the model. It then uses the reduced form equations to generate predicted values for the new observations that you include in the DATA= option. Again, predictions can be made for an observation if there are no missing values in the exogenous variables. You can also use this approach to obtain predicted values when there are no endogenous variables on the right-hand side of the equations to avoid refitting the model.

The examples that follow show how to obtain predicted values for new observations with and without endogenous variables on the right-hand side of the equations. The following DATA step creates data set KLEIN which is used in the SYSLIN and SIMLIN procedure steps below.

   data klein; 
      input year c p w i x wp g t k wsum; 
      date=mdy(1,1,year); 
      format date year.; 
      y   =c+i+g-t; 
      yr  =year-1931; 
      klag=lag(k); 
      plag=lag(p); 
      xlag=lag(x); 
      label c   ='consumption' 
            p   ='profits' 
            w   ='private wage bill' 
            i   ='investment' 
            k   ='capital stock' 
            y   ='national income' 
            x   ='private production' 
            wsum='total wage bill' 
            wp  ='govt wage bill' 
            g   ='govt demand' 
            t   ='taxes' 
            klag='capital stock lagged' 
            plag='profits lagged' 
            xlag='private product lagged' 
            yr  ='year-1931'; 
      datalines; 
   1921  41.9  12.4  25.5 -0.2  45.6  2.7   3.9   7.7  182.6  28.2 
   1922  45.0  16.9  29.3  1.9  50.1  2.9   3.2   3.9  184.5  32.2 
   1923  49.2  18.4  34.1  5.2  57.2  2.9   2.8   4.7  189.7  37.0 
   1924  50.6  19.4  33.9  3.0  57.1  3.1   3.5   3.8  192.7  37.0 
   1925  52.6  20.1  35.4  5.1  61.0  3.2   3.3   5.5  197.8  38.6 
   1926  55.1  19.6  37.4  5.6  64.0  3.3   3.3   7.0  203.4  40.7 
   1927  56.2  19.8  37.9  4.2  64.4  3.6   4.0   6.7  207.6  41.5 
   1928  57.3  21.1  39.2  3.0  64.5  3.7   4.2   4.2  210.6  42.9 
   1929  57.8  21.7  41.3  5.1  67.0  4.0   4.1   4.0  215.7  45.3 
   1930  55.0  15.6  37.9  1.0  61.2  4.2   5.2   7.7  216.7  42.1 
   1931  50.9  11.4  34.5 -3.4  53.4  4.8   5.9   7.5  213.3  39.3 
   1932  45.6   7.0  29.0 -6.2  44.3  5.3   4.9   8.3  207.1  34.3 
   1933  46.5  11.2  28.5 -5.1  45.1  5.6   3.7   5.4  202.0  34.1 
   1934  48.7  12.3  30.6 -3.0  49.7  6.0   4.0   6.8  199.0  36.6 
   1935  51.3  14.0  33.2 -1.3  54.4  6.1   4.4   7.2  197.7  39.3 
   1936  57.7  17.6  36.8  2.1  62.7  7.4   2.9   8.3  199.8  44.2 
   1937  58.7  17.3  41.0  2.0  65.0  6.7   4.3   6.7  201.8  47.7 
   1938  57.5  15.3  38.2 -1.9  60.9  7.7   5.3   7.4  199.9  45.9 
   1939  61.6  19.0  41.6  1.3  69.5  7.8   6.6   8.9  201.2  49.4 
   1940  65.0  21.1  45.0  3.3  75.7  8.0   7.4   9.6  204.5  53.0 
   1941  69.7  23.5  53.3  4.9  88.4  8.5  13.8  11.6  209.4  61.8 
   1942     .     .     .    .     .  8.5  13.8  11.6      .     . 
   1943     .     .     .    .     .  8.5  13.8  12.6      .     . 
   1944     .     .     .    .     .  8.5  13.8  11.6      .     . 
   1945     .     .     .    .     .  8.5  13.8  11.6      .     . 
   1946     .     .     .    .     .  8.5  13.8  11.6      .     . 
   1947     .     .     .    .     .  8.5  13.8  11.6      .     . 
   ;

proc print data = klein noobs;
   var year yr c wp i t w;
   run;

Example 1: Model with no right-hand side endogenous variables

The model is estimated using ordinary least squares (OLS) in PROC SYSLIN without right-hand side endogenous variables. Note that, for each equation, the explanatory variables are nonmissing for all observations. As a result, predicted values can be computed for all observations even those in which the dependent variable is missing. Each MODEL statement is followed by an OUTPUT statement including the PREDICTED= option. The OUT= option in the PROC SYSLIN statement specifies the data set that will contain the predicted values from all OUTPUT statements.

 proc syslin ols data = klein out = a;
    model c = wp yr;
    output predicted = pc;
    model i = t yr;
    output predicted = pi ;
    model w = yr;
    output predicted = pw;
    run;

proc print data = a noobs;
   var year pc pi pw;
   run;

Data set A contains predicted values of the endogenous variables for all observations where exogenous variables are nonmissing in the input data set.

Example 2: Model with right-hand side endogenous variables

The next model is estimated with right-hand side endogenous variables using three-stage least squares (3SLS) in PROC SYSLIN. The OUTEST= option in the PROC SYSLIN statement writes the parameter estimates to data set B, which will be used by the SIMLIN procedure.

proc syslin 3sls data = klein outest = b;
   instruments klag plag xlag wp g t yr;
   endogenous c p w i x wsum k y;

   consume: model c = p plag wsum; invest: model i = p plag klag; labor: model w = x xlag yr;

     product: identity x = c + i + g; 
     income:  identity y = c + i + g - t; 
     profit:  identity p = x - w - t; 
     stock:   identity k = klag + i; 
     wage:    identity wsum = w + wp; 
     run;

Using the OUTEST= data set produced by the SYSLIN procedure, the SIMLIN procedure can now compute the reduced form and simulate the model. The EST= option in the PROC SIMLIN statement reads in the data set created in the PROC SYSLIN step. The TYPE= option in the PROC SIMLIN step specifies the type of estimates to be read in from the EST= data set. Since the model contains lagged endogenous variables (klag, plag, and xlag) a LAGGED statement is needed to specify which variables contain lagged values, which endogenous variables they are lags of, and the number of periods of lagging. The OUTPUT statement with the P= and OUT= options names the output data set and variables that will contain the predicted values.

 proc simlin est=b data = klein type = 3sls ; 
    endogenous c p w i x wsum k y; 
    exogenous  wp g t yr; 
    lagged  klag k 1   plag p 1   xlag x 1; 
    id year; 
    output out = c p = chat phat what ihat xhat wsumhat khat yhat; 
    run;

proc print data = c noobs;
   var year chat phat what ihat xhat wsumhat khat yhat;
   run;

The predicted values for the endogenous variables computed from the simulation are written to the OUT= data set, C, shown below. Predictions are provided for all observations since there are no missing values in the exogenous variables.