# st: Solution for saving dprobit results with statsby

 From reetika@econdse.org To statalist@hsphsun2.harvard.edu Subject st: Solution for saving dprobit results with statsby Date Wed, 23 Jun 2004 13:32:24 +0500 (IST)

```Dear users,

A few days ago I was trying to save the marginal effects of multiple dprobit regressions with statsby and had asked for help. Now we've figured how to do it:

use "C:\literacy2.dta", clear
statsby "dprobit literacy  x y z a b c" x = (el(e(dfdx),1,1)) y = (el(e(dfdx),1,2)) z = (el(e(dfdx),1,3)), by(state agegrp)
//x=(el(e(dfdf),1,1) saves the marginal effect for x variable in the regression. The name with which we save this in the new file need not be the same as the one in the data file.
outsheet using "C:\lit1.csv", comma
//saves the results to a .csv file which is a comma delimited file that can be opened in excel.
dprobit results are saved in a matrix e(dfdx) the elements of which can be saved using el(m, n). Statsby works better than outreg, mfx because it seems as if each of those commands can only save the results of the last regression that stata has run. If one is performing regressions on subgroups of the data set (I have 25 states and four agegroups), this works like a charm.

Hope this is useful for some users,

Arudra and Reetika.
----------------------------------------------------------------------
Message was scanned and no virus found
----------------------------------------------------------------------
Email From "reetika@econdse.org" was security checked by 3.93  version of CxProtect(tm)
On: dsemail at: 13:32:24, 23-Jun-2004 Wednesday
----------------------------------------------------------------------
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```