Hello Stata Users,

I have a problem regarding a time-series regression for several industries. I am using stata13.

My data looks as follows:
Code:
clear
input float(Date mktrf smb hml rf agric mines oil)
-402  2.96  -2.3 -2.87 .22  2.1499999       2.42     -2.91
-401  2.64  -1.4  4.19 .25       1.98        .42      3.53
-400   .36 -1.32   .01 .23        -.8       -.45     -6.15
-399 -3.24   .04   .51 .32       -.78       -.66      -2.3
-398  2.53   -.2  -.35 .31       6.44       1.27        .6
-397  2.62  -.04  -.02 .28      -3.55          2      3.17
-396  -.06  -.56  4.83 .25      -3.91      -1.41      5.91
-395  4.18   -.1  3.17 .26       7.39       4.62      8.96
-394   .13  -1.6 -2.67  .3        -.9       3.21    -13.65
-393   .46   .43    .6 .25       5.14       1.06     -2.74
-392  5.44  1.41  4.93  .3       3.82  1.1099999     11.14
-391 -2.34   .47 -1.53 .26      -3.66      -5.46     -1.13
-390  7.26 -3.23 -1.16  .3       5.75       5.84 2.0900002
-389  1.97  -.72 -3.69 .28       1.71       1.62    -11.75
-388  4.76 -3.57  -.71 .21       7.12       2.63     11.75
-387 -4.31  2.13 -4.33 .25      -6.05      -4.78     -7.51
-386  6.58  2.76  -.31 .21        6.3       8.61     10.17
-385  2.09   .93 -1.06 .22      -1.04       6.71      3.93
-384  -.68  4.25  -.72 .25 -2.1399999      -2.65      -.17
-383  -1.7 -2.03  -.69 .33         .1 -4.2400002     -3.58
-382  8.81  -.26  -1.2 .29       1.42       5.86      6.34
-381  4.23  3.82  3.67 .22        -.5         .9     11.94
-380  1.52  2.98 -3.46 .32 -1.0999999       2.44      -.21
-379 -4.85  -3.5  -.06 .31      -2.44      -4.92     -8.18
-378   .62 -1.35  -.47 .32       -.61      -1.87      -.72
-377  6.68 -2.07 -2.11 .32       1.36       5.62      1.77
-376  2.88  2.18   .76 .27      -1.17       2.97      8.24
-375  1.33  2.27 -2.26 .41       4.32       3.34      -1.3
-374 11.81 -1.81   2.8 .38       1.26      12.89     10.54
-373   .36  -.85   -.6 .06      -1.34        .65    -14.78
end
format %tm Date
The problem is:
1. I want to do a time-series regression with a lag of 12 months for every industry (agric, mines, oil, etc.) and every month.
2. I want to summarize the coefficients and save them to make further calculations.

At the moment i am just able to do the regression for every industry once with a lag period of 12-month.

The code looks like this:

Code:
foreach x of varlist agric-oil {
regress L[(1/60).`x' L(1/60).mktrf L(1/60).smb L(1/60).hml 
}
To summarize, I need the sum of the individual coefficients for mktrf, smb and hml (the sum for L1. to L9. for mktrf in the example bellow) for every month in my observation and for every industry. As well I need the data available for further calculations.

Code:
Source |       SS       df       MS              Number of obs =    1050
-------------+------------------------------           F(180,   869) =    0.55
       Model |  28565.7057   180  158.698365           Prob > F      =  1.0000
    Residual |  252514.675   869  290.580754           R-squared     =  0.1016
-------------+------------------------------           Adj R-squared = -0.0845
       Total |  281080.381  1049  267.950792           Root MSE      =  17.046

------------------------------------------------------------------------------
       agric |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       mktrf |
         L1. |   .0844818   .1218709     0.69   0.488     -.154714    .3236775
         L2. |  -.0579726   .1250075    -0.46   0.643    -.3033246    .1873794
         L3. |  -.0551239   .1249082    -0.44   0.659    -.3002809     .190033
         L4. |   .0614014   .1247025     0.49   0.623    -.1833518    .3061546
         L5. |   .1953326   .1252396     1.56   0.119    -.0504748    .4411401
         L6. |   -.062288   .1272491    -0.49   0.625    -.3120395    .1874635
         L7. |  -.1434886   .1274496    -1.13   0.261    -.3936337    .1066565
         L8. |  -.0042542   .1274069    -0.03   0.973    -.2543154    .2458071
         L9. |   .0283648    .127659     0.22   0.824    -.2221912    .2789208

The final output should look somehow like this:
Code:
input float(Date agric_const agric_mktrf agric_smb agric_hml mines_const mines_mktrf mines_smb mines_hml)
-376 0.84 0.93 2.45 3.10 0.33 0.42 0.82 0.96
-375 0.92 0.91 2.30 1.72 0.38 0.40 0.80 0.90

I hope the problem gets clear.

Thank you very much in advance.
Kind regards,
Andreas