Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: how to store the statistics calculated in a loop as a table?


From   qing ye <[email protected]>
To   [email protected]
Subject   st: how to store the statistics calculated in a loop as a table?
Date   Thu, 8 Dec 2011 01:50:35 +0800

Dear all

Do any of you know how to report the results calculated after the loop
as tables??

forvalues i=1990 (1)2010 {
      foreach group of varlist FF_group_rank_0 {
              forvalues n=1(1)6{


                              quietly sum  EI_t if
trade_date_yearformat==`i' &FF_group_rank_0==`n'
                              local s_EI=r(sum)
                              quietly sum  BE_t_1 if
trade_date_yearformat==`i' &FF_group_rank_0==`n'
                              local s_BE=r(sum)
                              local mean_EI_BE=`s_EI'/`s_BE'


              }
              }
              }

I wanted to have the mean_EI_BE I calculated in the loops reported as a table

something like the following:

year      group1 group2 group3 group4 group5 group6

1990       x           x        x
1991       x           x        x
1992       x           x        x
1993       x           x        x
....



How do I do this? Do I need to use matrix commends to save the
mean_EI_BE I calculated each time or do I need to generate some
variables before the loop and store the mean_EI_BE in those variables?


Best
Qing
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index