Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Controlling Output in the Results Window


From   Thomas Jacobs <thomasjacobs@gmail.com>
To   StataList <statalist@hsphsun2.harvard.edu>
Subject   st: Controlling Output in the Results Window
Date   Tue, 17 Feb 2009 11:35:03 -0600

Fellow Listers,

I would appreciate any suggestions and comments on a workaround for
the following problem.  I am trying to constrain what appears in the
results window to just the printf statements the mata portion of my
stata program produces and have used the quietly command in a do file
that is repeatedly called by another do file to suppress the remainder
of the program.  Yet I cannot figure out how to hide the actual mata
code that writes the output I need to see.  For example, here is what
I see for a given call to this do program, which as the first comment
mentions I need to do within a loop or else my table is interspersed
with the lines used to write it:

 quietly {

.
. mata:
------------------------------------------------- mata (type end to
exit) ---------------------
:
: //Used one pass loop to clean up output
: for (mh=1; mh<=1;mh++) {
>
>         printf("Results for Event Period beginning with trading day %4.0f and ending at day %
> 4.0f\n",
>                  strtoreal(st_local("EventBeginDay")), strtoreal(st_local("EventEndDay")))
>         printf("Average Firm Adjusted R Square %12.4f\n",FirmModelResults[1,colFirm])
>         printf("\n")
>         printf("{txt}Average Firm Model{c |}        Coef        SampSE       t-stat\n")
>         printf("{hline 18}{c +}{hline 47}\n")
>
>         for (mi=1; mi<= colFirm-1; mi++) {
>
>                 printf("{txt}   %13s  {c |}", FirmModelVar[mi])
>
>                 for (mj=1; mj <=3; mj++) {
>
>                         printf("{res}    %9.4f",FirmModelResults[mj,mi])
>
>                 }
>
>                 printf("\n")
>
>         }
>
> }
Results for Event Period beginning with trading day 1380 and ending at day 1383
Average Firm Adjusted R Square       0.3394

Average Firm Model|        Coef        SampSE       t-stat
------------------+-----------------------------------------------
           L.FYR  |      -0.0361       0.1406      -1.6624
          L2.FYR  |       0.0220       0.0943       1.5113
            CDXR  |       0.6895       0.2835      15.7621
          L.CDXR  |       0.3952       0.1386      18.4800
           _cons  |      -0.0005       0.0038      -0.9309

:
: end
-----------------------------------------------------------------------------------------------

.
. *Back to stata to redisplay pooled results for comparison:
. *dis "`eqn'"
. *estimates replay Pooled
.
.
end of do-file


--
Thomas Jacobs
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index