title: Stata -- extract regression output for 3500 regressions run in a loop
body: <p>I am using a <code>forval</code> loop to run 3,500 regressions, one for each group.  I then need to summarize the results.  Typically, when I use loops to run regressions I use the estimates store function followed by <code>estout</code>.  Below is a sample code.  But I believe there is a limit of 300 that this code can handle.  I would very much appreciate if someone could let me know how to automate the process for 3,500 regressions.</p>
  
  <p>Sample code:</p>
  
  <pre><code>forval j = 1/3500 {
  
      regress y x if group == `j'
      estimates store m`j', title(Model `j')
  }
  
  estout m* using "Results.csv", cells(b t)   ///
     legend label varlabels(_cons constant)   ///
         stats(r2 df_r N, fmt(3 0 1) label(R-sqr dfres N)) replace
  </code></pre>