Bookmark and Share

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

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

Re: st: How to save results as .dat file

From   Joerg Luedicke <>
Subject   Re: st: How to save results as .dat file
Date   Thu, 24 Jan 2013 00:02:51 -0500

As all -ereturn- programs, GLLAMM stores a number of estimation
results in e(). Type -ereturn list- after running GLLAMM to see what's
there. For example, coefficients are stored in e(b), variances and
covariances can be obtained from e(V). What you then could do is to
store the desired results in a matrix from which you can create a
Stata dataset which then can be saved in the desired format. Consider
the following example where we create an empty matrix first, with 10
rows and 3 columns (and label the columns). We then run GLLAMM 10
times and each time around we put the results into one row of the


mat myest = J(10,3,.)
mat colnames myest = model b_age se_age

forval i = 1/10 {

	qui gllamm weight age girl, i(id)
	mat b = e(b)
	mat v = e(V)

	mat myest[`i',1] = `i'
	mat myest[`i',2] = b[1,1]
	mat myest[`i',3] = sqrt(v[1,1])
	qui replace age = age / `i'

You can look at the matrix by typing (see -help matrix-):

mat list myest

Finally, you can create a dataset with

svmat myest, names(col)

using the column names from the matrix as variable names (see -help
svmat-), after which you can save the dataset.


On Wed, Jan 23, 2013 at 11:04 PM, Cai,Zhuangyu <> wrote:
> Dear Stata users,
> I have to run GLLAMM 100 times in my code. How do I save the coefficient,
> standard errors, vanriance and covariance of random effect generated by
> GLLAMM everytime into a data set? Thanks for help.
> Zhuangyu
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index