ANALYZEDEP= Example for PROC MODEL

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

                    SAS Sample Library

        Name: moddm.sas
 Description: Example program from SAS/ETS User's Guide,
              The MODEL Procedure
       Title: ANALYZEDEP= Example for PROC MODEL
     Product: SAS/ETS Software
        Keys: nonlinear simultaneous equation models
        PROC: MODEL
       Notes:

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

ods graphics on;

proc fcmp outlib = work.funcs.test;
   function f(x);
      return(0);
   endsub;
   function g(x,y);
      return(0);
   endsub;
   function h(x,y);
      return(0);
   endsub;
   function i(x,y);
      return(0);
   endsub;
   function j(x,y,z);
      return(0);
   endsub;
run;

options cmplib = work.funcs;

proc model data=_null_;
   endo a b c d e;

   f(a)     = 0;
   g(a,b)   = 0;
   h(a,b)   = 0;
   i(b,d)   = 0;
   j(c,d,e) = 0;

   solve / analyzedep=(block);
quit;

/*---  Analyzing the Structure of Large Models  ---*/

data klein;
   input year c p w i x wp g t k wsum;
   date=mdy(1,1,year);
   format date monyy.;
   y   =c+i+g-t;
   yr  =year-1931;
   klag=lag(k);
   plag=lag(p);
   xlag=lag(x);
   label year='Year'
         date='Date'
         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'
         i   ='Taxes'
         klag='Capital Stock Lagged'
         plag='Profits Lagged'
         xlag='Private Product Lagged'
         yr  ='YEAR-1931';
datalines;
1920     .  12.7     .    .  44.9    .     .     .  182.8     .
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
;

proc model  out=m data=klein listdep graph block;
   endogenous c p w i x wsum k y;
   exogenous  wp g t year;
   parms c0-c3 i0-i3 w0-w3;
   a: c = c0 + c1 * p + c2 * lag(p) + c3 * wsum;
   b: i = i0 + i1 * p + i2 * lag(p) + i3 * lag(k);
   c: w = w0 + w1 * x + w2 * lag(x) + w3 * year;
   x = c + i + g;
   y = c + i + g-t;
   p = x-w-t;
   k = lag(k) + i;
   wsum = w + wp;
   id year;
quit;